I want to discuss what I've learned about the mouse_event subroutine, and I think this might be of some use to many here in the 5&6 forum.
Declare sub mouse_event Lib "user32" (byval dwFlags as long, ByVal dx as Long, byval dy as long, ByVal cButtons as long, ByVal dwExtraInfo as Long)
dx and dy are mouse coordinates, not twips or pixels or points... there are something like 65,000 units on X and 65,000 units on Y. I don't recall the exact number of units.
ok, so here are some example calls:
mouse_event MOUSEEVENTF_ABSOLUTE or MOUSEEVENTF_MOVE, 200, 200,0,0
This call moves the mouse to 200,200 (the cButtons and dwExtraInfo are not used as far as I can tell)
Remember, the x and y coordinates are mouse_coordinates, not twips or points... You can do some conversions between this coordinate system and twips but I don't have the exact figures on them so well worry about that later on. I'll find that sooner or later and update you on this.
Here's how to do the clicks:
mouse_event MOUSEEVENTF_ABSOLUTE or MOUSEVENTF_LEFTDOWN, 200,200,0,0
Sends a mouse down (first half of a click)
and as you might guess, the second half of the click is done with:
mouse_event MOUSEEVENTF_ABSOLUTE Or MOUSEEVENTF_LEFTUP, 200,200,0,0
Now here's something else to chew on... if you Omit the "MOUSEEVENTF_ABSOULTE Or" then you are no longer telling the mouse the absolute position to do the function... it's now a relative position, so 200, 200 for dx and dy would now be 200 mouse X units from its current X position, and 200 Y units from it's current Y position.
Experiment with this and you'll get an understanding of simulating moving and clicking the mouse.
Remember, your dx and dy grid is 65,000 some odd units each direction, so your dx and dy values are LONG
Three simple calls let you move to a point, mouse_down and mouse_up. You can omit the "move" and just send the mouse_down and Mouse_up in a spot to do it quicker if you need too.
More to come... Merry Christmas!
Tuna - It's fat free until you add the Mayo!