开发者

Error with RegOpenKeyEx

I'm using Code::blocks to write a program that changes the registry, but when I call

RegOpenKeyEx (HKEY_LOCAL_MACHINE,
              "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunOnce", 
               0, 
               KEY_ALL_ACCES | KEY_WOW64_64KEY, 
               &key);

codeblocks return

`KEY_WOW64_64KEY' undeclared (first use in this fu开发者_运维知识库nction)

I had add #include <windows.h> but it still doesn't work.

Thanks :)


You need to define a Windows target version of XP or greater to have access to this. You are probably targeting Windows 2000.

In targetver.h (or wherever you define _WIN32_WINNT) you need this:

#define _WIN32_WINNT 0x0501 //targets XP or later
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜