I'm trying to get a value from a registry key, and the final program has to work on both 32 & 64 bit machines.
The code so far is:
HKEY hKey;
LONG Result1;
LONG result2;
Result1 = RegOpenKeyEx(HKEY_CLASSES_ROOT,L"Word.Application\\CurVer",0,KEY_READ,&hKey);
cout << Result1;
cout << "\n";
TCHAR value[255];
DWORD BufferSize = 255;
result2 = RegGetValue(hKey, L"Word.Application\\CurVer", L"", RRF_RT_ANY, NULL, (PVOID)&value, &BufferSize);
cout << result2;
I'm getting the error '2' back from RegGetValue, and looked at this RegOpenKeyEx/RegGetValue return ERROR_FILE_NOT_FOUND on keys that exist which says that it will not work if it's '32 bit code on a 64 bit OS' but I do not understand what this means.
Is it the program that has to be compiled for different architectures, or is it RegGetValue that is specific to 32 bit?
Sorry, most of my C++ programming was done back before 64bit computers became mainstream, and none of the occasional items I've written since have had this problem.