|
From: Bruno B. <bbe...@cl...> - 2001-06-18 20:58:47
|
Hi !
Here is a sample code for version checking:
#include <stdio.h>
#include <windows.h>
#include <winreg.h>
#define BufferSize 255
void NoAR()
{
printf("Acrobat Reader is not installed\n");
exit();
}
int main(int argc, char *argv[])
{
PHKEY hKey, hKeyAdobe,hKeyAcrobatR;
LONG Result;
WORD iSubKey=0;
char Buffer[BufferSize];
/* check for the key "software" */
Result=RegOpenKeyEx(HKEY_LOCAL_MACHINE,"software",0,KEY_READ,&hKey);
/* all right then look for the "Adobe" subkey */
if (Result==ERROR_SUCCESS)
{
Result=RegOpenKeyEx(hKey,"Adobe",0,KEY_READ,&hKeyAdobe);
if (Result!=ERROR_SUCCESS) NoAR();
Result=RegOpenKeyEx(hKeyAdobe,"Acrobat Reader",0,KEY_READ,&hKeyAcrobatR);
if (Result!=ERROR_SUCCESS) NoAR();
/*print all the subkeys */
while(Result!=ERROR_NO_MORE_ITEMS)
{
Result=RegEnumKey(hKeyAcrobatR,iSubKey, Buffer, BufferSize);
printf("%s\n", Buffer);
iSubKey++;
};
}
else printf("No Software key\n");
return 0;
}
|