Solved

mouseclick windows sdk

Posted on 2007-11-27
3
255 Views
Last Modified: 2010-05-18
http://msdn2.microsoft.com/en-us/library/ms648390.aspx


mouse_event(MOUSEEVENTF_LEFTDOWN,   x, y, 0, 0); // Left Key Down
mouse_event(MOUSEEVENTF_UP,   x, y, 0, 0); // Left Key UP


I just want to click the mouse, is it possible to not having getcursorpos first and then put it in?

http://www.experts-exchange.com/Programming/Languages/CPP/Q_22986461.html
0
Comment
Question by:Troudeloup
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 6

Accepted Solution

by:
SeanDurkin earned 500 total points
ID: 20362690
Is this what you mean? This should click the mouse wherever it is, but you have to set the MOUSEEVENTF_ABSOLUTE flag to make sure it clicks the current mouse position, instead of the x and y relative to it.
POINT point;
GetCursorPos(&point);
mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_ABSOLUTE,  point.x, point.y, 0, 0);
mouse_event(MOUSEEVENTF_UP | MOUSEEVENTF_ABSOLUTE, point.x, point.y, 0, 0);

Open in new window

0
 

Author Comment

by:Troudeloup
ID: 20362699
yeah, this is what I was afraid of. but it works :D
0

Featured Post

Ready to get started with anonymous questions?

It's easy! Check out this step-by-step guide for asking an anonymous question on Experts Exchange.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

627 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question