Click to See Complete Forum and Search --> : Check if value in reg exists.. Help!


cube01
August 17th, 1999, 04:54 AM
I need to see if a value in the registry exists...
I know how to see if a subkey exists, but not a particular value within' that subkey...
any help on this would be much appreciated... thanks... Cube

Jeep
August 17th, 1999, 06:12 AM
First open the subkey:

char myValueData[100];
DWORD myDataSize;
LONG myRegResult;
DWORD myRegType;
DWORD myOptions = 0;
myRegResult =::RegOpenKeyEx(HKEY_LOCAL_MACHINE,
PATH,
myOptions,
KEY_ALL_ACCESS,
&myRegKey);




and then get the value

myDataSize = sizeof(myValueData);
myRegResult = ::RegQueryValueEx(myRegKey,
"myKey",
NULL,
&myRegType,
(LPBYTE)myValueData,
&myDataSize);


CString myValue(myValueData);





myValue now contains the value of the given key. Hope it helps!!

Ciao, Jeep