Dance little mouse! Dance!
Hi!
Actually I have a very simple problem, which however seems to be completetly undocumented. I tried 4-5 books, but neither mentioned it. Ok here it is:
I want to move the mouse icon manually by the program code and Windows should think that the user moved the mouse. As far as I can see I only need to manually send a message to the Windows message queue. There is a command for this: SendMessage or PostMessage, however I am just unable to let them work.
Can anyone help me?
My companies website: www.nielsbauergames.com
Jester101,
I think there is a command you can send to move the mouse cursor to a certain position on the screen (or is to set the starting position when the window is opened?, I can't remember). You should be able to write some sort of algorithm that interpolates all the positions between two points on the screen and places the mouse at each intermediate point over a certain time frame.
If you want Windows to think the user did this, you might try using PostMessage() like you suggested.
Good luck,
Paulcoz.
Edited by - paulcoz on 4/12/00 5:33:59 AM
I think there is a command you can send to move the mouse cursor to a certain position on the screen (or is to set the starting position when the window is opened?, I can't remember). You should be able to write some sort of algorithm that interpolates all the positions between two points on the screen and places the mouse at each intermediate point over a certain time frame.
If you want Windows to think the user did this, you might try using PostMessage() like you suggested.
Good luck,
Paulcoz.
Edited by - paulcoz on 4/12/00 5:33:59 AM
Ok so I use postmessage(). But how?
I use the following:
SendMessage(handle, WM_MOUSEMOVE, Position, Buttons);
1. How can I set the handle, so that the message is send to the main windows queue?
2. Position: LoWord = X, HiWord = Y. But how to convert a 100,100 into LoWord and HiWord???
I use the following:
SendMessage(handle, WM_MOUSEMOVE, Position, Buttons);
1. How can I set the handle, so that the message is send to the main windows queue?
2. Position: LoWord = X, HiWord = Y. But how to convert a 100,100 into LoWord and HiWord???
My companies website: www.nielsbauergames.com
To convert the params for a message you can use the macros MAKELPARAM and MAKEWPARAM, defined as follows:
LPARAM MAKELPARAM(WORD wLow, WORD wHigh);
WPARAM MAKEWPARAM(WORD wLow, WORD wHigh);
wLow and wHigh are the loword and hiword values.
If you store the handle of your main window in a global variable at creation time, it is always available for later use.
*Sparkle*
LPARAM MAKELPARAM(WORD wLow, WORD wHigh);
WPARAM MAKEWPARAM(WORD wLow, WORD wHigh);
wLow and wHigh are the loword and hiword values.
If you store the handle of your main window in a global variable at creation time, it is always available for later use.
*Sparkle*
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement