Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

PostMessage and its parameters

Posted on 2000-03-21
5
Medium Priority
?
476 Views
Last Modified: 2013-11-20
How do i can set postmessage parameters, in order to be able to move for example, the mouse, how do i set the coordinates?

Thanks
0
Comment
Question by:emilioamo
  • 2
  • 2
5 Comments
 
LVL 23

Expert Comment

by:chensu
ID: 2642075
To move the mouse cursor, use the SetCursorPos function.

POINT pt;
::GetCursorPos(&pt);

pt.x += 3;
pt.y += 7;

::SetCursorPos(pt.x, pt.y);
0
 

Author Comment

by:emilioamo
ID: 2644070
I'm trying to move the cursor, using postmessage function, and sending WM_MOUSEMOVE signal to windows.
0
 
LVL 9

Accepted Solution

by:
ShaunWilde earned 150 total points
ID: 2644825
If you want to set the x,y coords in the LPARAM then you can use the MAKELPARAM macro.

MAKELPARAM(low,high)  so for you this would be MAKELPARAM(x,y)

NOTE: x,y must be in screen coords
0
 
LVL 23

Expert Comment

by:chensu
ID: 2646273
pWnd->PostMessage(WM_MOUSEMOVE, 0, MAKELPARAM(x, y));

The x and y are coordinate relative to the upper-left corner of the client area of pWnd.
0
 
LVL 9

Expert Comment

by:ShaunWilde
ID: 2648224
oops chensu is right it is client area not screen (my mistake) :(
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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. …
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.
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

824 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