Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Jester101

Dance little mouse! Dance!

This topic is 6789 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Advertisement
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

Share this post


Link to post
Share on other sites
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???

Share this post


Link to post
Share on other sites
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*

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!