Previous Thread:   Registry Cleaners...

9/14/2005 11:38:20 PM    Problem in reading the Media File Installation path
Why I am not getting the Registry value with the following code?  
  
Thanks for ur time and advise  
  
long lRet;  
  
HKEY hKeySettings;  
  
DWORD dwSize;  
  
DWORD  nType = REG_SZ;  
  
dwSize=MAX_PATH ;  
  
char* szValName="Installation Directory";  
  
char* dwSettingsData=NULL;  
  
try  
  
{  
  
lRet = RegOpenKeyEx(HKEY_LOCAL_MACHINE,  
  
"SOFTWARE\\Microsoft\\MediaPlayer",0, KEY_ALL_ACCESS, &hKeySettings);  
  
if (lRet==ERROR_SUCCESS)  
  
{  
  
MessageBox("Pass1","",MB_OK);  
  
}  
  
}  
  
catch(...)  
  
{  
  
MessageBox("fail1","",MB_OK);  
  
}  
  
try  
  
{  
  
lRet = RegQueryValueEx(hKeySettings, szValName, NULL, NULL,  
  
(LPBYTE)dwSettingsData, &dwSize);  
  
if (lRet==ERROR_SUCCESS)  
  
{  
  
MessageBox("Pass2","",MB_OK);  
  
}  
  
}  
  
catch(...)  
  
{  
  
MessageBox("fail2","",MB_OK);  
  
}  
  
MessageBox((LPCTSTR)dwSettingsData,"",MB_OK);  
  
RegCloseKey(hKeySettings);