Click here to Skip to main content
15,902,922 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Comments
[no name] 11-Sep-12 1:34am    
Did you try Google?
ZiDoM 11-Sep-12 2:43am    
of course i always do that
[no name] 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 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
bbirajdar 11-Sep-12 5:30am    
I found one for you. You MUST check it here

 
Share this answer
 
Comments
ZiDoM 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 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.
https://sites.google.com/site/moxingjiazi/jia-li-jia/ru-men-ji-chu/zhu-kong-tai/xi-tong/huashuliandian
 
Share this answer
 
Comments
ZiDoM 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 21-Sep-12 5:44am    
+5 good solution if we don't care about which application receives the event
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.
 
Share this answer
 
Comments
pasztorpisti 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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900