HKEY hkResult;
LONG lRet = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\pbrush.exe",
0,
KEY_READ,
&hkResult);
if (ERROR_SUCCESS == lRet)
{
lRet = RegQueryValueEx(
hkResult,
L"Path",
NULL,
NULL,
NULL,
NULL
);
if (ERROR_SUCCESS == lRet)
{
MessageBox(L"ERROR_SUCCESS");
}
else
{
CString strMessage;
strMessage.Format(L"Error code is %d",lRet);
MessageBox(strMessage);
}
}
else
{
MessageBox(L"RegOpenKeyEx failed.");
}