// Ouverture de la base de registre
LPCTSTR DataBasePath;
char lpszName []= "Chemin";
HKEY hKey = 0;
HRESULT hr = RegOpenKey(HKEY_LOCAL_MACHINE,
_T("SOFTWARE\\DivXManage" ),
&hKey);
if (hr == ERROR_SUCCESS)
{
// Lecture de la clé
TCHAR szProductType[200];
DWORD dwBufLen = 200;
RegQueryValueEx(hKey,lpszName, NULL, NULL, (LPBYTE)szProductType, &dwBufLen);
DataBasePath = szProductType;
}
else
{
DataBasePath = GetPathOfDB();
// Creation de la clé
hKey = 0;
hr = RegCreateKey(HKEY_LOCAL_MACHINE,
_T("SOFTWARE\\DivXManage" ),
&hKey);
if (hr == ERROR_SUCCESS)
{
RegSetValueEx(hKey,
lpszName,
0,
REG_SZ,
(const BYTE*)DataBasePath,
strlen(DataBasePath));
}
}
RegCloseKey(hKey);