Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Mouse?

Posted on 1999-01-15
2
Medium Priority
?
163 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 6

Accepted Solution

by:
thresher_shark earned 1200 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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…
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
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.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…

688 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