-
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
-
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 :p
www.cintelsoftware.co.uk
-
'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.