Results 1 to 5 of 5

Thread: Mouse....

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 2000
    Posts
    344
    How do i capture the mouse position and write it into a label?
    -RaY
    VB .Net 2010 (Ultimate)

  2. #2
    Junior Member
    Join Date
    Jul 2000
    Posts
    22
    You must use GetCursorPos


    'Put this on your module page
    Type POINTAPI
    x As Long
    y As Long
    End Type

    Declare Function GetCursorPos Lib "user32.dll" (lpPoint As POINTAPI) As Long


    'On your form page
    Private Sub Command1_click()

    Dim Coord as POINTAPI

    GetCursorPos Coord 'get the cursor position
    Debug.Print "X coord : " & Coord.x 'Show the x position
    Debug.Print "Y coord : " & Coord.y 'Show the y position

    End Sub


    Enjoy !

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    May 2000
    Posts
    344

    Once again

    I'm drawn back with vb3.0...there has to be a way to do it with user.dll, i tried rewriting yours but i get a duplicate procedure when it tries to call the function. Any ideas.
    -RaY
    VB .Net 2010 (Ultimate)

  4. #4
    Junior Member
    Join Date
    Jul 2000
    Posts
    22

    Talking

    OOppss !!

    I have missed "Public".
    The right syntax is :
    Public Declare Function GetCursorPos Lib "user32.dll" (lpPoint As POINTAPI) As Long

    Re Enjoy!

  5. #5
    Guest
    That still wont work. "User32" is still for 32-bit platforms. Try changing it to
    Code:
    Declare Function GetCursorPos Lib "user.dll" (lpPoint As POINTAPI) As Long
    Or
    Code:
    Declare Function GetCursorPos Lib "user16.dll" (lpPoint As POINTAPI) As Long

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width