corduroy9
asked on
Query Registry for Specific Value
Hi,
Using C++ I need some code to find a specific value of a key.
So for example, if I have ...\....\....\...\IBM
Inside that folder one of the keys is called Vaild. I need to get the 'Data' or value back.
How would you go about this?
Using C++ I need some code to find a specific value of a key.
So for example, if I have ...\....\....\...\IBM
Inside that folder one of the keys is called Vaild. I need to get the 'Data' or value back.
How would you go about this?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
REGSAM sam = KEY_ALL_ACCESS;
char* pszKey = "...\\....\\....\\...\\IBM
if ( ERROR_SUCCESS != RegOpenKeyEx ( HKEY_LOCAL_MACHINE, pszKey, 0, sam, &hKey)) {
return; // nothing to do...
}
DWORD dwType = REG_DWORD;
DWORD dwSize = sizeof ( DWORD);
DWORD dwValue;
if ( ERROR_SUCCESS == RegQueryValueEx (
hKey,
"Valid",
NULL,
&dwType,
( LPBYTE) &dwValue,
&dwSize)
) {
}
RegCloseKey ( hKey);
}