GetCursorPos
宣告法:
Declare Function GetCursorPos Lib "user32" Alias "GetCursorPos" (lpPoint As POINTAPI) As Long
Type POINTAPI
x As Long
y As Long
End Type
用法介紹:
用來取得滑鼠的XY軸
範例:
Option Explicit
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Type POINTAPI
x As Long
y As Long
End Type
Private Sub Form_Activate()
Dim A As POINTAPI
Do
DoEvents
GetCursorPos A
Label1.Caption = "滑鼠位置: X:" & A.x & " Y:" & A.y
Loop
End Sub
實戰個案: