Jump to content
  • Advertisement
Sign in to follow this  
Dark Star

Retrieving the mouse coordinates in Windows

This topic is 5475 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

Advertisement
Likely you'll want to trap some mouse message like say,

WM_LBUTTONDOWN in your wndproc, this will give you two things

wParam and lParam. Loosely speaking the first two bytes of lparam is the x coord and the next two are the y coord.

x = HIWORD(lParam);
y = LOWORD(lParam);

is typical.

Hope this helps.

jbc.


Share this post


Link to post
Share on other sites
thanks for that. I was just wondering if there is a function that can retrieve the coordinates because where I need those coordinates are in a different location from my WindowProc() function.


Thanks

DarkStar
UK

Share this post


Link to post
Share on other sites
Quote:
Original post by Dark Star
thanks for that. I was just wondering if there is a function that can retrieve the coordinates because where I need those coordinates are in a different location from my WindowProc() function.


off the top of my head, not I can think of. Maybe just write something in the wndproc to respond to mouse moves (WM_MOUSEMOVE) and record the x,y pos, and write your own function to return their values.

jbc

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!