Results 1 to 3 of 3

Thread: Force mouse arrow position

  1. #1
    Guest

    Post

    If I have a command button on a form moving
    the form up, when I click, the form goes up and the mouse arrow stays at previous position of command button; if the user wants to click twice or more, he has to move the mouse after each click;
    How can I do to force mouse arrow to follow the command button?
    Thank you

  2. #2
    Hyperactive Member
    Join Date
    Jan 2000
    Posts
    355

    Post

    use the SetCursorPos API: look it up in API viewer.

    Then, to set the cursor pos to the command button's pos:

    SetCursorPos command1.left / screen.twipsperpixelX, command1.top / screen.twipsperpixelY


    that should work, although twips/pixels thing might be dodgy try and see

    ------------------
    cintel rules
    www.cintelsoftware.co.uk

  3. #3
    Member
    Join Date
    Jan 2000
    Location
    IL
    Posts
    39

    Post

    'goes into a module
    Declare Function SetCursorPos& Lib "user32" _
    (ByVal x As Long, ByVal y As Long)

    ' goes into the program
    Private Sub TimerClicker_Timer()
    TM& = SetCursorPos&(x, y)
    End Sub

    X and Y represent coordinates on the screen. You will have to tinker with it to get the right coordinates, and you say the program moves each time you click the button (how annoying) If so you will need an entry like..

    Y = Y + a

    In wich a = the no of coordinates the program moves in that direction.

    get it? I hope, cuase I can't explain it any better.

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