Solved

How can I set the mouse to a specific locale?

Posted on 1998-12-21
2
168 Views
Last Modified: 2013-11-20
How can I set the mouse to a specific location?  I would like to be able to set it to any location on the screen, but I can't seem to figure out how.  Of course, I haven't loaded the help files, and leaving the CD in all the time is no good, so I suppose I haven't been trying too hard either.  Can anyone help me?
0
Comment
Question by:jonjons
2 Comments
 
LVL 6

Accepted Solution

by:
thresher_shark earned 400 total points
ID: 1326543
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.

If you have additional questions, please feel free to ask.  Thanks!
0
 

Author Comment

by:jonjons
ID: 1326544
Thanks, that has solved my problem completely.  I appreciate it.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Separate into files by filename 12 91
How to know only "File created" with EventLog 3 35
either24  challenge 19 105
matchUp  challenge 9 123
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

685 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