Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ Java Mouse
I am trying to find a way to do mouse actions in java.
 
Can someone pls tell me how to move the mouse to a particular point on the screen using c++.I found a class named "Robot" of the awt package in java that serves my purpose..but the problem is that my project is in c++ and so i need a way to do the same job in c++.
 
Can someone tell me some classes, functions, etc. that would allow me to move and click the mouse.
 
P.S. I am not looking for detecting mouse events...
Posted 19-Mar-12 5:58am
Comments
SAKryukov at 19-Mar-12 11:34am
   
Why?!
--SA
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

What is this? you are trying to move the cursor using C++ code in Java application?
 
WHY?
 
Only Idea I can come up with is to trigger the Java Application and let that one do the cursor move: Google on "Java moving cursor"[^]
  Permalink  
Comments
Anirudh sundar at 19-Mar-12 11:19am
   
Its a c++ application...not a java application....i just wanted a class in c++
that did the same function as Robot class in java
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Hi, You can use SetCursorPos function for positioning mouse.
and mouse_event function can be used for mouse event.
  Permalink  
Comments
blacklabel01_ at 18-Jan-13 12:56pm
   
hello I am just new in c++ programming language and I have been using VC++ 2008 , I just want to ask if there are any code of example of mouse clicked , left or right, console application ...I was confused of some code/function in windows.h and I don't understand how to use each function and variables ... I am looking for this, for the sake of my grade bcoz my grade depend on our project ... thank you ...
cnli at 20-Jan-13 10:51am
   
Yes, SetCurPos and mouse_event function are win32 api.
and we can also use those apis in console app.
So we can make mouse click in console app,programatically.
Thanks.
cnli at 20-Jan-13 10:52am
   
And for those apis, you can reference MSDN or some forums.

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

  Print Answers RSS
0 OriginalGriff 299
1 Maciej Los 295
2 Sergey Alexandrovich Kryukov 205
3 Aajmot Sk 202
4 Sinisa Hajnal 166
0 OriginalGriff 7,760
1 Sergey Alexandrovich Kryukov 7,072
2 DamithSL 5,604
3 Manas Bhardwaj 4,986
4 Maciej Los 4,785


Advertise | Privacy | Mobile
Web01 | 2.8.1411023.1 | Last Updated 19 Mar 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