vb.net mouse position

VNote 2020.04.15 10:56:18 *:

    Structure PointAPI

        Public x As Int32 ' Integer if you prefer

        Public y As Int32 ' Integer if you prefer

    End Structure

    Public Declare Function GetCursorPos Lib "user32" (ByRef lpPoint As PointAPI) As Boolean

    Declare Function ScreenToClient Lib "user32" (ByVal hwnd As Int32, ByRef lpPoint As PointAPI) As Int32

 

    Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer1.Tick

        Dim lpPoint As PointAPI

        GetCursorPos(lpPoint)

        Label1.Text = "x:  " & CStr(lpPoint.x)

        Label2.Text = "y:  " & CStr(lpPoint.y)

    End Sub

 

 

j.PNG