c++ - 帮助!错误 C2040 : 'HWINEVENTHOOK' : 'DWORD' differs in levels of indirection from 'HWINEVENTHOOK__ *'

标签 c++ windows visual-c++ sdk

我正在一个新机器 (vista 64) 上编译我的应用程序,现在它不再编译了。编译器给我标题中的错误。问题似乎(?)是 HWINEVENTHOOK 在

中定义了两次

windef.h

#if(WINVER >= 0x0400)
DECLARE_HANDLE(HWINEVENTHOOK);
#endif /* WINVER >= 0x0400 */

然后在 winable.h 中是

#if WINVER < 0x0500 // these structures and functions
                    // are in NT 5.00 and above winuser.h
typedef DWORD   HWINEVENTHOOK;

但是,我刚刚查找了 vista 的 WINVER,它是 0x0600,而 windows XP 是 0x0501 那么为什么要定义 DWORD?我不知所措。有人帮忙吗?

最佳答案

根据 this MSDN forum thread :

winable.h was moved from the Windows SDK in July 2005 because functionality was duplicated in winuser.h. It was determined at that time that efforts would be better spent on updating winuser.h to Windows Vista-level functionality rather than updating the functionality of both files.

您使用的是哪个版本的 Windows SDK,您的代码面向哪个 Windows 版本?目标 Windows 版本可以在 makefile、项目文件或头文件中指定。在 Vista 上编译代码并不一定意味着目标版本是 Vista。

此外,您是否尝试过从 winable.h 切换到 winuser.h?

关于c++ - 帮助!错误 C2040 : 'HWINEVENTHOOK' : 'DWORD' differs in levels of indirection from 'HWINEVENTHOOK__ *' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/657163/

相关文章:

c++ - 未声明的标识符 'QVariant' 将旧版 Qt 4 转换为 5

C++ 隐式转换不起作用

c++ - 有条件的 Windows 管理员提示

c++ - 为什么包含windows.h会产生语法错误,从而阻止类的实例化? (C2146,C2065)

c++ - MSVC 2012 通过 SFINAE 检测模板函数的模板参数数量

c++ - 如何使用模板简化结构?

c++ - Qt3D 围绕网格旋转相机

windows - 在播放器的音频到达真正的声卡之前拦截它

windows - 如何为我的 .inf 创建 Windows 安装包?

OpenCV 窗口无法加载