Windows7和Win64是一個新的平臺我,編程明智,所以不知道發生了什麼,我用windows7 64bit下的命令保存在Windows註冊表中的一個鍵,問題是相同的代碼是能夠返回REG_OPENED_EXISTING_KEY返回值,這意味着密鑰創建是成功的,並且該函數能夠在後續調用中讀取/打開密鑰,但是當我嘗試在regedit.exe中找到位置的密鑰時,我不能在HKLM_LOCAL_MACHINE/Software/MyProject和HKLM_LOCAL_MACHINE/Software/Wow6432Node/MyProject中都不會顯示在樹中。我的註冊表條目在哪裏? Windows 7和Win64
任何人都可以清楚這裏發生了什麼嗎?
HKEY hKey ;
HKEY key = HKEY_LOCAL_MACHINE;
DWORD disValue ;
string subKey = "Software\\MyProject\\";
LONG retValue = RegCreateKeyEx(key, subKey.c_str(), 0, 0, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, 0, &hKey, &disValue) ;
if (retValue == ERROR_SUCCESS)
{
if (disValue == REG_CREATED_NEW_KEY)// new key created. This value will change to REG_OPENED_EXISTING_KEY if the key already existed, the function then simply open the key.
return true;
return false;
}
您是否以管理員身份運行?你有沒有註冊表虛擬化? –
@Roger否我不是,我的程序也不是,即使當我以管理員身份運行regedit.exe時,我看不到條目。不確定註冊表可視化是什麼。 – StudentX