Solved

PostMessage and its parameters

Posted on 2000-03-21
5
454 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 50 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

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

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: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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 this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

910 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

21 Experts available now in Live!

Get 1:1 Help Now