Google Answers Logo
View Question
Q: Simulate Mouse Click ( No Answer,   3 Comments )
Subject: Simulate Mouse Click
Category: Computers > Programming
Asked by: afmatt-ga
List Price: $10.00
Posted: 22 Oct 2006 19:37 PDT
Expires: 21 Nov 2006 18:37 PST
Question ID: 775936
Is there a way using Windows API calls to simulate a mouse click at a
specific location WITHOUT moving the mouse to that location? Most
procedures using SetCursorPos, which is what I want to avoid.
There is no answer at this time.

Subject: Re: Simulate Mouse Click
From: frde-ga on 22 Oct 2006 23:49 PDT
If you know the handle of the control that you want to click (assuming
it has one) then you could uses SendMessage with WM_LBUTTONDOWN then

You could look at the SendInput API

Personally I would move the mouse, do Mouse_Event and then move the
mouse back to its original position.
Subject: Re: Simulate Mouse Click
From: afmatt-ga on 25 Oct 2006 11:36 PDT
The control does not have a handle. Also, I do not want to move the
mouse at all. Any ideas?
Subject: Re: Simulate Mouse Click
From: frde-ga on 26 Oct 2006 00:00 PDT
Strictly speaking if it does not have a Handle then it is not a Control
- it will be a pseudo control drawn on a real one

Did you look into the SendInput API ?
- from MSDN I could not figure out whether a Click paid any attention
to the mouse co-ordinates in the Structure.

Why don't you want to move the Mouse ?
Maybe there is a workaround for the reason why you don't want to move it.

You might be better off asking in a programming News Group.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  

Google Home - Answers FAQ - Terms of Service - Privacy Policy