Results 1 to 3 of 3

Thread: [RESOLVED] moving the mouse

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2006
    Posts
    129

    Resolved [RESOLVED] moving the mouse

    If i click on a picturebox how can i get it so the mouse moves to the top left of the picture box?
    Resizing
    System Balloons

    If your question is answered, please mark the thread resolved by pulling down the Thread Tools menu and clicking the Mark Thread Resolved button.

    Remember to rate a post if you find it helpful

  2. #2
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: moving the mouse

    Would this work for you?
    VB Code:
    1. Option Explicit
    2.  
    3. Private Type RECT
    4.     Left As Long
    5.     Top As Long
    6.     Right As Long
    7.     Bottom As Long
    8. End Type
    9.  
    10. Private Declare Function SetCursorPos Lib "user32" _
    11.     (ByVal X As Long, ByVal Y As Long) As Long
    12.  
    13. Private Declare Function GetWindowRect Lib "user32" _
    14.     (ByVal hwnd As Long, lpRect As RECT) As Long
    15.  
    16. Private Sub Picture1_Click()
    17. Dim rec As RECT
    18.  
    19.     GetWindowRect Picture1.hwnd, rec
    20.     SetCursorPos rec.Left, rec.Top
    21.  
    22. End Sub

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Feb 2006
    Posts
    129

    Re: moving the mouse

    Thanks
    Resizing
    System Balloons

    If your question is answered, please mark the thread resolved by pulling down the Thread Tools menu and clicking the Mark Thread Resolved button.

    Remember to rate a post if you find it helpful

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