🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

moving the mouse within a program?

Started by
2 comments, last by Electron 24 years, 6 months ago
Not sure what exactly you're asking here.

If you want to track the position of the mouse pointer, just capture the WM_MOUSEMOVE event in your message loop. The X position will be in the LOWORD portion of lParam, and the Y position will be in the HIWORD portion of lParam.

If you're trying to move the mouse to a specific co-ordinate, you might want to investigate using the following:

::PostMessage(hWnd, WM_MOUSEMOVE, 0, MAKELPARAM(xPos,yPos));

I'm not sure how well that will work, if at all though. So, if anybody else has a better suggestion...

Advertisement
Is there anyone who know how to manipulate the mouse coordinates with a program? (in Windows, of course)

------------------
Electron

"Who need more than 64kb of RAM?" -Bill gates -89


--Electron"The truth can be changed simply by the way you accept it.""'General failure trying to read from file' - who is General Failure, and why is he reading my file??"
Use SetCursorPos(x, y). Simple, eh? By the way, MSDN is a really good resource for this sort of stuff.

--TheGoop

You might want to just use the Win32 function SetCursorPos.

Regards

Starfall

This topic is closed to new replies.

Advertisement