gpt4 book ai didi

c++ - 在 Windows 中读取当前鼠标坐标

转载 作者:行者123 更新时间:2023-11-28 02:49:29 24 4
gpt4 key购买 nike

如何使用 C++ 读取窗口中鼠标的当前位置?
我想从鼠标访问原始数据并显示坐标。

最佳答案

使用 Windows API,您可以使用 GetCursorPos()。我现在无法编译代码来测试它,但它应该会像这样运行:

POINT cursor;
if (GetCursorPos(&cursor)) {
// Print out cursor.x and cursor.y
}

我确定您已完成此操作,但请务必包含 windows.h

关于c++ - 在 Windows 中读取当前鼠标坐标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23395498/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com