PDA

Click to See Complete Forum and Search --> : mouse click event coding


Bunty
Dec 29th, 1999, 02:58 AM
I remember seeing some code on vb-world.net a while back on how to make the system right click or left click and also how to make them double click. I searched and i can't find it anymore on the web at all. Can someone link me to somewhere or can someone just make a bas file and send me a copy of it to my email address? i really need this for some program i am working on. Thanks, i need this asap...

im trying to make a program that will move the mouse around to certain areas of the screen and then click or double click on that spot. So i need the code for the system to right/left to click/double click
thats what i need...can you help?

<BantyRan@optonline.net>

zorro
Dec 29th, 1999, 03:16 AM
Bunty, you will need to use API for that. There is too much code for me to list. I will send you soure code for it.

Serge
Dec 29th, 1999, 09:53 AM
Try this:

Private 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)
Private Declare Function SetCursorPos Lib "user32" (ByVal X As Long, ByVal Y As Long) As Long
Private Const MOUSEEVENTF_LEFTDOWN = &H2
Private Const MOUSEEVENTF_LEFTUP = &H4
Private Type POINTAPI
X As Long
Y As Long
End Type

Public Sub ClickMouse(X As Long, Y As Long)
SetCursorPos X, Y
mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0
mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
End Sub


Passing your coordinates will click the left button on the mouse.

Example: ClickMouse 500, 500

------------------

Serge

Software Developer
Access8484@aol.com
ICQ#: 51055819 (http://www.icq.com/51055819)