Pas besoin de tout alourdir en rajoutant MFC!
Voici un exemple :
HKEY hMainKey;
unsigned long size;
unsigned long type;
if(RegOpenKey(HKEY_CURRENT_USER, "Software\\Product", &hMainKey) != ERROR_SUCCESS)
{
if(RegOpenKey(HKEY_CURRENT_USER, "Software\\Product", &hMainKey) != ERROR_SUCCESS)
return;
}
size = 256;
RegQueryValueEx(hMainKey, "Mp3Path", 0, &type, (unsigned char*)g_Mp3Path, &size);
size = 256;
RegQueryValueEx(hMainKey, "PlayerPath", 0, &type, (unsigned char*)g_PlayerPath, &size);
size = 256;
RegQueryValueEx(hMainKey, "FileFilter", 0, &type, (unsigned char*)g_FileFilter, &size);
size = 256;
RegQueryValueEx(hMainKey, "UserFilter", 0, &type, (unsigned char*)g_UserFilter, &size);
size = 256;
RegQueryValueEx(hMainKey, "IPFilter", 0, &type, (unsigned char*)g_IPFilter, &size);
size = 256;
RegQueryValueEx(hMainKey, "ServerIP", 0, &type, (unsigned char*)g_ServerIP, &size);
size = 4;
RegQueryValueEx(hMainKey, "Role", 0, &type, (unsigned char*)&g_Role, &size);
RegCloseKey(hMainKey);