I am Creating the Registry Key using following code:
LPCTSTR lpNDS= TEXT("SOFTWARE\\myKEY"); if(OK==ERROR_SUCCESS) { MessageBox ( NULL, "Success", _T("SimpleShlExt"), MB_ICONINFORMATION ); } else { MessageBox ( NULL, "Failed" , _T("SimpleShlExt"), MB_ICONINFORMATION ); } LONG openRes = RegCreateKeyEx( HKEY_LOCAL_MACHINE, lpNDS, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hRegKey, NULL); if (openRes!=ERROR_SUCCESS) MessageBox ( NULL, "Registry Createion Failed", _T("SimpleShlExt"), MB_ICONINFORMATION ); Now I am writing up to the Key using:
CSimpleShlExt::WriteToRegistry(LPSTR lpRegKeyVal) { LONG setRes = RegSetValueEx (hRegKey, "NDS", 0, REG_SZ, (LPBYTE)lpRegKeyVal, strlen(lpRegKeyVal)+1); CloseRegistryKey(); } Now I am trying read the registry key value that I have created using WriteToRegistry function. I have tried with
RegOpenKeyEx(hRegKey,lpNDS,0,KEY_QUERY_VALUE,&hRegKey); But this is failing.
Which function shall I use to read the value contained inside the key?