出于某种原因,当我尝试使用keyRegOpenKey()
该函数打开注册表时返回错误(它返回数字 2)。我怎样才能解决这个问题?我的 IDE 是代码块,我正在使用 Windows XP 机器。提前致谢!
#include <iostream>
#include <windows.h>
using namespace std;
int main()
{
//{75048700-ef-11-d0-9888-006097deac}
HKEY var;
char bob[1900];
int k;
k = RegOpenKey(HKEY_CURRENT_USER,"software\\microsoft\\windows\\currentVersion\\explorer\\UserAssist\\{75048700-ef-11-d0-9888-006097deac}\\count",&var);
if (k==ERROR_SUCCESS)
{
cout<<"CALL 1 WAS SUCCESSFULL : "<<var<<" "<<k<<endl;
if (RegEnumKey(var,0,bob,200)==ERROR_SUCCESS)
{
cout<<"CALL 2 WAS SUCCESSFULL "<<bob<<endl;
}
else
{
cout<<"CALL 2 FAILED: "<<bob<<endl;
}
}
else
{
cout<<"CALL WAS NOT SUCCESSFULL "<<var<<" "<<k<<endl;
}
RegCloseKey(var);
return 0;
}