c++ - GetCursorPos 工作正常但 GetPhysicalCursorPos "not declared in this scope"?

标签 c++ winapi codelite

我正在编写一些代码(在 Codelite 中),使用的是 GetCursorPos(),没问题。但是当我想调用 GetPhysicalCursorPos() 时,它说它没有在此范围内声明...

与 SetCursorPos 一样工作正常但 SetPhysicalCursorPos 不行...

他们应该都能正常工作,因为我包含了 windows.h,不知道该怎么做...

我尝试从 user32.dll 导入它,但它不应该是那样的......

谢谢你帮助我。

最佳答案

GetPhysicalCursorPos API是在Vista/Server 2008才加入的,所以需要定义

#define WINVER 0x0600

在包含 windows 头文件之前。有关更多信息,请参见 MSDN 主题:Using the Windows Headers .

另一种可能是您的头文件已过时。也许您使用的编译器没有附带最新的 SDK。如果是这种情况,那么您可以尝试更高版本的编译器、不同的编译器,甚至是 MS 官方提供的 SDK。

您应该注意的一件事是,依赖此 API 将意味着您的程序将无法在 XP 上运行。

关于c++ - GetCursorPos 工作正常但 GetPhysicalCursorPos "not declared in this scope"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20380484/

相关文章:

go - 如何进行dll注入(inject)

winapi - Windows 为 ANSI 版本 WM_CHAR 生成 UTF8 序列?为什么我看不到它?

c - 制作 libcurl CodeLite 项目

c - 如何让我的 C 编辑器支持 Intellij 键盘映射?

c++ - 最佳实践 : A compose B, DerivedA compose DerivedB

c++ - Arduino 使用 C 还是 C++?

c++ - C++中有没有办法同时在多个线程上调用join?

c++ - 模板类多重定义

c - 随机文本作为输出

c++ - 设置输出引脚上忽略的媒体类型