如何取得MOUSE的位置?我很菜

解决方案 »

  1.   

    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
      

  2.   

    那位老兄缺少了调用
    我补上Private sub command_click()
      Dim z As POINTAPI 
      GetCursorPos z
      Label1 = "x: " & z.x   '  X 坐标  
      Label2 = "y: " & z.y  ’ Y 坐标 
    End sub
      

  3.   

    Sorry显示的是调用API的那行出错(‘注释’前加了')