マウスの現座標はWindowsAPIのGetCursorPosで取得します。
マウスの現座標を取得する(GetCursorPos)サンプルコード
'■WindowsAPI取得のため、宣言(32bit/64bit) #If Win64 Then Declare PtrSafe Function GetCursorPos Lib "User32" (lpPoint As cPoint) As Long #Else Declare Function GetCursorPos Lib "User32" (lpPoint As cPoint) As Long #End If Type cPoint x As Long y As Long End Type Public Sub sample() Dim c As cPoint '■マウスの現在座標を取得する GetCursorPos c Debug.Print c.x & " " & c.y '290 46 例 End Sub
注意点
- 特にありません。
コメント