How can i emulate mouse click of left or right button
Posted on 2003-09-12 04:43:02 by Marty
Posted on 2003-09-12 05:09:56 by Delight
example pls
Posted on 2003-09-12 07:15:23 by Marty
You also may think of sending dummy mouse messages to do the same, it might be easier (depending on exactly what you want to do).
Posted on 2003-09-12 17:11:53 by QvasiModo
Now that I thought about it, whom should I send the messages?

When I want to make a certain window think the mouse is doing "stuff" in it, I imagine I just send it the msgs, but:
- will the mouse pointer move due the msg?
- what if the mouse gets over another window, and I keep sending the msgs to the same window?

Or, should I send messages to a "bigger thing", to emulate the mouse action before the "wich window is mouse in" evaluation? What is this "thing"?
Posted on 2003-09-13 02:55:55 by wicr0s0ft
Then the mouse pointer moves, the system sends messages to the windows indicating this event. So by sending messages yourself, you are simulating the system's notification of that event, not the event itself. So the mouse pointer will not move, you're just causing a window "believe" that it has.

To move the pointer there's an Api, but if you just want an app to react to mouse moves send messages instead. Perhaps you could move the mouse pointer itself if you also want to user to see it.
If you send messages to a window and the coords. are wrong, the result depends on how well the app reacts to this error. You should not send messages in that case.

What you could do, if you want a window in your app to receive the mouse moves for all windows, is to capture the mouse or set a global mouse hook (two very different techniques, for different pourposes).

Then there's also the mouse_event call, but I won't say anything about it because I never used it, so I know nothing about it... :(
Posted on 2003-09-13 11:40:48 by QvasiModo
haven't looked at mouse_event either. what I'm using is wm_lbuttondown to simulate a mouse click. it's part of an automation app. the trouble i'm running into is how to determine when the next step of the automation should take place. waitforinputidle doesn't seem to be enough.

there's an app called wintask lite that does this quite nicely. looks like it's using the same approach i started with...window name, class, and z-order as the target. still it doesn't use a timer-based approach...and it works pretty flawlessly. wish I could figure out the exact api sequence.
Posted on 2003-09-17 21:56:26 by grv575
Perhaps you could install a windows hook in that app. That way you can monitor window messages - and make your program choices based on that...
Posted on 2003-09-18 17:43:40 by QvasiModo