Solved

Mouse?

Posted on 1999-01-15
2
152 Views
Last Modified: 2013-11-20
I would like to be able to programmatically move the mouse on the screen.  I would like to have the mouse automatically wrap from one side of the screen to the other.  Some Mouse drivers provide this functionality, I just want to know if it is possible.  Is there some way I can change the coordinates the mouse is at?
0
Comment
Question by:cyberuser
2 Comments
 
LVL 6

Accepted Solution

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

To integrate this with your program, you would probably want to set a timer, and then continually check to see if the cursor is on a certain side of the screen (which can be determined with GetCursorPos, I think, and a call to GetSystemMetrics (SM_CXSCREEN) and SM_CYSCREEN)

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

Author Comment

by:cyberuser
ID: 1327769
Thank you.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Expand macro to include alternate header placement and naming 5 66
Adapt this command to show who installed 29 106
ORA-01403: no data found 43 90
unix example issues 18 76
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
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.
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

863 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

19 Experts available now in Live!

Get 1:1 Help Now