Click to See Complete Forum and Search --> : HOW TO: Simulate/force mouse click...


maciej
January 21st, 2000, 01:23 PM
Does anyone have any idea? Workaround, hints, etc...
I tried using PostMessage() but that does not seem to work.

--maciej

Aaron Young
January 21st, 2000, 01:32 PM
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()
Call mouse_event(MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
End Sub





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

February 2nd, 2000, 07:15 AM
First get the handle for the object you want to click. You can use functions like "findwindow", "getwindow"... ONce you get the window, use the API "sendmessage". Here is an example:

call sendmessage(buttonhWnd%, WM_LBUTTONDOWN, 0&, 0&)
call sendmessage(buttonhWnd%, WM_LBUTTONUP, 0&, 0&)



that should click an object. hope it helped!

-Will DaProgramma@cs.com