VB打开程序 如果鼠标点击屏幕的 XX坐标(不在VB界面上点) 然后就提示msgbox "ss" 怎么做哦

解决方案 »

  1.   

    这是源码!
    Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As LongPrivate Type POINTAPI
            x As Long
            y As Long
    End Type
    Private Sub Timer1_Timer()
    Dim a As POINTAPI
    GetCursorPos a
    If a.x = 0 And a.y = 0 Then
        MsgBox "haha"
    End If
    End Sub
      

  2.   

    Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As LongPrivate Type POINTAPI
            x As Long
            y As Long
    End TypePrivate Sub Form_Click()
    Me.Cls
    End SubPrivate Sub Timer1_Timer()
    Dim a As POINTAPI
    GetCursorPos a
    Print a.x, a.y
    End Sub