如何获取光标位置 [英] How to get the cursor position

查看:154
本文介绍了如何获取光标位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何在c ++中获取Windows上的光标位置,



原因:我试图在XY坐标上移动鼠标位置, / p>

例如:我想在屏幕上的偏移x:576 y:854中设置鼠标位置。



我发现的唯一的方法是:

  mouse_event(MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE | MOUSEEVENTF_LEFTDOWN,x,y, 0); 

通常标志MOUSEEVENTF_ABSOLUTE是这样做,但它不工作,这就是为什么我试图得到

解决方法:鼠标的绝对位置并尝试计算!



谢谢您的回答!方案

尝试 GetCursorPos()。 / p>

I want to know how to get the cursor position on Windows in c++,

Reasons: I try to move the mouse position on X Y coordinate with the screen information

e.g: i want to set the mouse position in the offset x:576 y:854 on the screen.

The only method that I found for do that is:

mouse_event(MOUSEEVENTF_ABSOLUTE|MOUSEEVENTF_MOVE|MOUSEEVENTF_LEFTDOWN,x,y,0,0);

Normally the flag MOUSEEVENTF_ABSOLUTE is to do that but it doesn't work, that's why i try to get the absolute position of the mouse and try to calculate that !

Thank you for your answer !

解决方案

Try GetCursorPos().

这篇关于如何获取光标位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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