读书人

注册表操作失败,该如何解决

发布时间: 2013-01-18 10:22:42 作者: rapoo

注册表操作失败

HKEY hKey;
//找到系统的启动项
LPCTSTR lpRun = "Software\\Microsoft\\Windows\\CurrentVersion\\Run";
//打开启动项Key
long lRet = RegOpenKeyEx(HKEY_LOCAL_MACHINE, lpRun, 0, KEY_ALL_ACCESS, &hKey);


if(lRet == ERROR_SUCCESS)
{

//查询
DWORD type=REG_SZ;
DWORD Data=80;
BYTE owner_Get[80];
long ret=::RegQueryValueEx(hKey, "kxesc ",NULL,&type,owner_Get,&Data); //获取playback的键值



ret的值是2



Return value
If the function succeeds, the return value is ERROR_SUCCESS.
If the function fails, the return value is a system error code.



[解决办法]
看看返回值是多少 用getlasterror查一下
[解决办法]
ERROR_FILE_NOT_FOUND

2 (0x2)

The system cannot find the file specified.

读书人网 >C++

热点推荐