Retrieving the mouse coordinates in Windows
hi Forum, could anyone tell me how to go about retrieving the mouse coordinates in Windows?
Thanks
DarkStar
UK
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.
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.
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
Thanks
DarkStar
UK
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
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement