Solved

How to set the position of the mouse?

Posted on 1998-12-03
2
141 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
This video discusses moving either the default database or any database to a new volume.

747 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

15 Experts available now in Live!

Get 1:1 Help Now