开发者

Error with RegOpenKeyEx

开发者 https://www.devze.com 2023-02-15 15:38 出处:网络
I\'m using Code::blocks to write a program that changes the registry, but when I call RegOpenKeyEx (HKEY_LOCAL_MACHINE,

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

精彩评论

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