有什麼不對?當我想要獲得AUVersion的價值時,它會崩潰。這個密鑰存在於註冊表中,但我無法得到它。從註冊表C++崩潰獲取值
int main(int argc, char *argv[])
{
HKEY key;
if (RegOpenKey(HKEY_LOCAL_MACHINE, TEXT("SOFTWARE\\JavaSoft\\Auto Update\\"), &key) != ERROR_SUCCESS)
{
cout << "Unable to open registry key\n\n";
}
char path[1024];
DWORD value_length = 1024;
//here is the crash
RegQueryValueEx(key, "AUVersion", NULL, (LPDWORD)REG_SZ, (LPBYTE)&path, &value_length);
cout << "the value read from the registry is: " << path << endl;
system("pause");
return 0;
}
謝謝!它訣竅 – deepspace 2013-03-25 18:28:54
Downvoter:爲什麼? – nneonneo 2013-03-25 18:32:17
@ user1857483如果這是答案,您應該接受它。點擊此答案的綠色複選框。 – StarPilot 2013-03-25 18:34:23