zz71108401 發表於 2020-7-2 21:49:36

求助滑鼠的按鍵語法QQ

我想詢問VB6 滑鼠指定絕對位置的語法 (只需要&H即可) 找了很多篇都沒找到QQ
目前只知道這些
相對移動 &H1
左鍵按下 &H2
左鍵彈起 &H4
右鍵按下 &H8
右鍵彈起 &H10
中鍵按下 &H20
中鍵彈起 &H140
滾輪 &H800

qwas963563 發表於 2020-7-2 21:49:37

本帖最後由 qwas963563 於 2020-7-2 22:20 編輯

SetCursorPos
這個 API 去查查看

https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-mouse_event
或者看看 API 說明

MOUSEEVENTF_ABSOLUTE
0x8000
The dx and dy parameters contain normalized absolute coordinates. If not set, those parameters contain relative data: the change in position since the last reported position. This flag can be set, or not set, regardless of what kind of mouse or mouse-like device, if any, is connected to the system. For further information about relative mouse motion, see the following Remarks section.

這貌似是絕對座標
我自己沒試過
你可以試試

zz71108401 發表於 2020-7-3 07:35:15

qwas963563 發表於 2020-7-2 22:18 static/image/common/back.gif
SetCursorPos
這個 API 去查查看



mouse_even 我看過了 0X8000是無法使用 可能是我語法問題
SetCursorPos 這個我能移動了 感謝大神!

qwas963563 發表於 2020-7-3 10:26:24

zz71108401 發表於 2020-7-3 07:35 static/image/common/back.gif
mouse_even 我看過了 0X8000是無法使用 可能是我語法問題
SetCursorPos 這個我能移動了 感謝大神! ...

我查了下 0X8000 是可以使用的 只是要處理下座標就是了
屏幕坐标要如下转换:
dx = point.x * 65535 / ScreenWidth;
dy = point.y * 65535 / ScreenHeight;

zz71108401 發表於 2020-7-3 12:10:54

qwas963563 發表於 2020-7-3 10:26 static/image/common/back.gif
我查了下 0X8000 是可以使用的 只是要處理下座標就是了
屏幕坐标要如下转换:
dx = point.x * 65535 / Sc ...

對阿 所以我想說 用SetCursorPos 這個函數就可以了 方便多 感謝大哥!
頁: [1]
查看完整版本: 求助滑鼠的按鍵語法QQ