PDA

Click to See Complete Forum and Search --> : How do I send a mouse click similar to SendKey


Ant2ne
Jan 27th, 2000, 04:57 AM
I want to send mouse clicks to an application like I do SendKey, I already designed a method to get the mouse to the properlocation on the destination, I just don't know how to send the click to it.

Aaron Young
Jan 27th, 2000, 07:22 AM
Use the Mouse_Event API, ie.
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 Const MOUSEEVENTF_LEFTDOWN = &H2
Private Const MOUSEEVENTF_LEFTUP = &H4

Private Sub Command1_Click()
mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
End Sub

------------------
Aaron Young
Analyst Programmer
aarony@redwingsoftware.com
ajyoung@pressenter.com

Ant2ne
Jan 27th, 2000, 11:44 AM
Excuse me if I'm stupid. I'm pretty new at this and all. What part of that codes is a Module and what part goes into the "form" section of my program?

shragel
Jan 28th, 2000, 01:07 AM
Everything goes in to the form.
All Lines starting with the word PRIVATE if you change it to the word PUBLIC can be put in the MODULE.