chris
Veteran Member
Posts: 1137 Reputation: 2
36 / / –
Joined: May 2003
|
RE: Windows registry: how hard can it be...
code: MPPLUGIN_RETURN_BOOL Initialize(/*[in]*/ DWORD nVersion,
/*[in]*/ const char* sUserEmail,
/*[in]*/ IDispatch* iMessengerObj)
{
bool retValue = TRUE;
long retCode = 0;
HKEY regKey;
unsigned long szType = 0, szSize = MAX_PATH;
unsigned char szValue[MAX_PATH];
retCode = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE/Patchou/MsgPlus2",
0, KEY_QUERY_VALUE, ŪKey);
if (retCode != ERROR_SUCCESS)
{
MessageBox(NULL, "Error opening registry", "Error", MB_OK);
retValue = FALSE;
}
else
{
retCode = RegQueryValueEx(regKey, "PluginDir", NULL,
&szType, szValue, &szSize);
if (retCode != ERROR_SUCCESS){ retValue = FALSE;
MessageBox(NULL, "Error reading registry", "Error", MB_OK);
}
else strcpy(sPluginPath,
reinterpret_cast<const char*>(szValue));
}
retCode = RegCloseKey(regKey);
if (retCode != ERROR_SUCCESS){ retValue = FALSE;
MessageBox(NULL, "Error closing registry", "Error", MB_OK);
}
return retValue;
}
Try that You can thank DJM for it
This post was edited on 11-20-2003 at 01:54 PM by chris.
|
|