RegOpenKeyEx 错误 [英] Error with RegOpenKeyEx

查看:28
本文介绍了RegOpenKeyEx 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Code::blocks 编写一个更改注册表的程序,但是当我调用时

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);

代码块返回

`KEY_WOW64_64KEY' 未声明(首次在该函数中使用)

`KEY_WOW64_64KEY' undeclared (first use in this function)

我添加了 #include 但它仍然不起作用.
谢谢:)

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

推荐答案

您需要定义 XP 或更高版本的 Windows 目标版本才能访问它.您的目标可能是 Windows 2000.

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

在 targetver.h(或任何你定义 _WIN32_WINNT 的地方)你需要这个:

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

#define _WIN32_WINNT 0x0501 //targets XP or later

这篇关于RegOpenKeyEx 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆