2009-08-07 8 views

Répondre

1

Cela fonctionne pour moi:

// Open the key 
HKEY hKey; 
if(SUCCEEDED(::RegOpenKey(HKEY_LOCAL_MACHINE, TEXT("SOFTWARE\\Mozilla\\Mozilla Firefox"), &hKey))) 
{ 
    // Query the required buffer size for the requested value 
    DWORD cbData; 
    if(SUCCEEDED(::RegQueryValueEx(hKey, TEXT("CurrentVersion"), NULL, NULL, NULL, &cbData))) 
    { 
     // Now that we have the size, allocate a buffer and query the value 
     TCHAR* buf = new TCHAR[cbData/sizeof(TCHAR)]; 

     if(SUCCEEDED(::RegQueryValueEx(hKey, TEXT("CurrentVersion"), NULL, NULL, (LPBYTE)buf, &cbData))) 
     { 
      ::OutputDebugString(buf); 
     } 
    } 
} 
+0

Les fonctions Reg ne renvoient pas HRESULT, donc RÉUSSI n'est pas la macro sont les plus appropriés. Mais le résultat LONG qu'ils reviennent est compatible. – selbie

Questions connexes