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

RegCreateKeyEx为什么总是返回5

2012-12-29 
RegCreateKeyEx为何总是返回5HKEY hKeyDWORD dwLONG reg RegCreateKeyEx(HKEY_LOCAL_MACHINE, _T(SOF

RegCreateKeyEx为何总是返回5
HKEY hKey;
DWORD dw;
LONG reg = RegCreateKeyEx(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\test"), 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &rKey, &dw);//(LPDWORD)REG_CREATED_NEW_KEY);

用以上语句创建注册表子键的时候reg总是等于5,为什么?如何才能成功创建子键?
[解决办法]
参考这篇(http://www.vckbase.com/index.php/wv/446.html)文章。
[解决办法]
If the function fails, the return value is a nonzero error code defined in Winerror.h. You can use the FormatMessage function with the FORMAT_MESSAGE_FROM_SYSTEM flag to get a generic description of the error.

热点排行