Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ Win32
How we can make mouse click event in a certain position without moving mouse(I mean that make computer think a position is clicked with mouse) with C++
Posted 10-Sep-12 19:29pm
ZiDoM292
Comments
pwasser at 11-Sep-12 1:34am
   
Did you try Google?
ZiDoM at 11-Sep-12 2:43am
   
of course i always do that
pwasser at 11-Sep-12 4:27am
   
Really, you perhaps need to spend some time learning how to do a Google search because the answer posted can be found in that way. Do you see where I'm going?
ZiDoM at 11-Sep-12 4:34am
   
most of the search results are about changing the mouse position so because of that its hard to find my exact answer and yes i always need to learn if you have a good book or article about google search that i haven't seen yet i would like to read plz share
aspnet_regiis at 11-Sep-12 5:30am
   
I found one for you. You MUST check it here
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

  Permalink  
Comments
ZiDoM at 11-Sep-12 3:26am
   
I used
PostMessage(hwnd,WM_LBUTTONDOWN,MK_LBUTTON,MAKELPARAM(p.x, p.y));
PostMessage(hwnd,WM_LBUTTONUP,MK_LBUTTON,MAKELPARAM(p.x, p.y));
but it clicks where the mouse is it doesn't click the position i told to click
pasztorpisti at 21-Sep-12 5:46am
   
+5 works fine in a lot of cases, we are able to send the event to a specific application but this isn't a true equivalent of a real event. For example GetKeyState() will not work with this as expected.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

https://sites.google.com/site/moxingjiazi/jia-li-jia/ru-men-ji-chu/zhu-kong-tai/xi-tong/huashuliandian
  Permalink  
Comments
ZiDoM at 11-Sep-12 6:58am
   
mouse_event(MOUSEEVENTF_LEFTDOWN,813,731, 0, 0);
mouse_event(MOUSEEVENTF_LEFTUP,813,731, 0, 0);
doesn't work still it clicks the position the cursor is it doesn't click (813,731)
pasztorpisti at 21-Sep-12 5:44am
   
+5 good solution if we don't care about which application receives the event
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

General windows environment mouse_event can click
However, in some games, their message loop with the windows are different,
You need to know that they are using directx or opengl or what graphics engine,
The only way to send the mouse to click on the message.
  Permalink  
Comments
pasztorpisti at 21-Sep-12 5:43am
   
+5 good point

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web03 | 2.8.140926.1 | Last Updated 21 Sep 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100