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.