vb.net mouse position

    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

 

 

이 게시물을

공유하기

SEARCH

MENU NAVIGATION