I've looked and looked to no avail... How do I send a left mouse click via code?
Morgan [email protected] - Home [email protected] - Work Using VB6 SP6 but trying to learn VB2005EE
not sure what you mean by SEND if you wanna capture it in mousedown of a contro/form Code: if Button = 1 then msgbox "you have clicked left button" end if sorry if that didn't help
if Button = 1 then msgbox "you have clicked left button" end if
Developer News Developer Toolz Free C# iCodeLibrary - Code Organizer - WITH FREE CODE Free Developer Toolz | Hire Me as a Consultant | C# 4 Unix | Free C# Books | |
No, not capture it..I want to essentially click the left mouse button, but using code...Not the mouse itself...
hmmm you gotz to use apis for dis one i think if you elaborate more on what your using this click for, i or someone else could help you come up with an alternative of doing it sorry about first post, since i totally didn't get the question
Here is how to send a mouse click using the mouse_event api function. Code: 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) Public Const MOUSEEVENTF_LEFTDOWN = &H2 Public Const MOUSEEVENTF_LEFTUP = &H4 Call mouse_event(MOUSEEVENTF_LEFTDOWN, 0&, 0&, 0&, 0&) Call mouse_event(MOUSEEVENTF_LEFTUP, 0&, 0&, 0&, 0&)
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) Public Const MOUSEEVENTF_LEFTDOWN = &H2 Public Const MOUSEEVENTF_LEFTUP = &H4 Call mouse_event(MOUSEEVENTF_LEFTDOWN, 0&, 0&, 0&, 0&) Call mouse_event(MOUSEEVENTF_LEFTUP, 0&, 0&, 0&, 0&)
Forum Rules