首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

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

2013-01-18 
注册表操作失败HKEY hKey //找到系统的启动项 LPCTSTR lpRun Software\\Microsoft\\Windows\\CurrentV

注册表操作失败

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.

热点排行