在Win7中模拟鼠标左键单击给定位置的代码在Win10和Win11中不好使了,谁知道怎么解决?
以下是在Win7中模拟鼠标左键单击给定位置的代码,在Win10和Win11中能移到指定位置,却不能实现单击了。谁知道怎么解决?*--模拟鼠标动作,如 单击左键
MOUSEEVENTF_LEFTDOWN=0x2
MOUSEEVENTF_LEFTUP=0x4
MOUSEEVENTF_MIDDLEDOWN=0x20
MOUSEEVENTF_MIDDLEUP=0x40
MOUSEEVENTF_MOVE=0x1
MOUSEEVENTF_ABSOLUTE=0x8000
MOUSEEVENTF_RIGHTDOWN=0x8
MOUSEEVENTF_RIGHTUP=0x10
Declare mouse_event In Win32API Integer dwFlags,Integer dx,Integer dy,Integer cButtons,Integer dwExtraInfo
*在鼠标坐标系统中,不管什么分辨率屏幕在水平和垂直方向上均匀分割成65535×65535个单元
=mouse_event(MOUSEEVENTF_ABSOLUTE+MOUSEEVENTF_MOVE,10000,10000,0,0) &&移动鼠标到绝对位置10000,10000
=mouse_event(MOUSEEVENTF_LEFTDOWN+MOUSEEVENTF_LEFTUP,0,0,0,0) &&单击左键(按下再松开的组合)
*=mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0)
*=mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0)