Click here to Skip to main content
13,085,292 members (57,232 online)
Rate this:
Please Sign up or sign in to vote.
See more:
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 4:58am
SAKryukov 19-Mar-12 11:34am
Rate this: bad
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?


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"[^]
Anirudh sundar 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
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.
blacklabel01_ 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 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.
cnli 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
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.170813.1 | Last Updated 19 Mar 2012
Copyright © CodeProject, 1999-2017
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