Solved

How to set the position of the mouse?

Posted on 1998-12-03
2
147 Views
Last Modified: 2013-11-20
Hi

How can I set the position of the mouse to a specific location on the screen?  I would like to simply give a function a coordinate and have it set the position, but I am unsure what the function is.  Or is there a function that lets me do that?  I don't know anything.... please enlighten me!

Thank you and regards
0
Comment
Question by:bobshoe
  • 2
2 Comments
 
LVL 6

Accepted Solution

by:
thresher_shark earned 170 total points
ID: 1325748
Answer coming...
0
 
LVL 6

Expert Comment

by:thresher_shark
ID: 1325749
To set your mouse to a specific location, you want to use the SetCursorPos function.  You provide it an X and Y value, and it will set the cursor to that position.  Here is an excerpt from the online help:

The SetCursorPos function moves the cursor to the specified screen coordinates.  If the new coordinates are not within the screen rectangle set by the most recent ClipCursor function, Windows automatically adjusts the coordinates so that the cursor stays within the rectangle.

BOOL SetCursorPos
(int X, // horizontal position
 int Y // vertical position
);
 
Parameters:

X
Specifies the new x-coordinate, in screen coordinates, of the cursor.

Y
Specifies the new y-coordinate, in screen coordinates, of the cursor.
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
cat dog challenge 18 124
Detect CR LF to each line 12 158
abstract class with all non abstract mentods 6 76
mapAB Challlenge 35 142
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

816 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now