Option ExplicitType POINTAPI '注释:Declare types x As Long y As Long End TypeDeclare Function GetCursorPos Lib "user32" _ (lpPoint As POINTAPI) As Long 注释:Declare API4. Open up Form1 and add two labels and one timer. Set the interval property of the timer to 1. Open up the code window to form1 and type the following Private sub command_click() Dim z As POINTAPI Label1 = "x: " & z.x ' X 坐标 Label2 = "y: " & z.y ’ Y 坐标 End sub
那位老兄缺少了调用 我补上Private sub command_click() Dim z As POINTAPI GetCursorPos z Label1 = "x: " & z.x ' X 坐标 Label2 = "y: " & z.y ’ Y 坐标 End sub
x As Long
y As Long
End TypeDeclare Function GetCursorPos Lib "user32" _
(lpPoint As POINTAPI) As Long 注释:Declare API4. Open up Form1 and add two labels and one timer. Set the interval property of the timer to 1. Open up the code window to form1 and type the following
Private sub command_click()
Dim z As POINTAPI
Label1 = "x: " & z.x ' X 坐标
Label2 = "y: " & z.y ’ Y 坐标
End sub
我补上Private sub command_click()
Dim z As POINTAPI
GetCursorPos z
Label1 = "x: " & z.x ' X 坐标
Label2 = "y: " & z.y ’ Y 坐标
End sub