GetCursorPos() question (easily answered)

Started by
4 comments, last by Unliterate 20 years, 1 month ago
Can someone describe (or just give me some code) how to use GetCursorPos(); (windows api). Ive checked msdn.. and .. it didnt really help. I know i pass a structure with an x and y variable in (maybe a pointer to the structure (??), i really didnt understand the stuff at msdn) but I cant get anything to work.
Advertisement
POINT pt;

GetCursorPos(&pt);

int x = pt.x;
int y = pt.y;
thank you
How can i get the windows current x and y position? (to get the mouseposition in relation to the window)
//Global variables for window posint g_windowX,g_windowY;//////Message handlingcase WM_MOVE:  g_windowX = (int)LOWORD(lParam)  g_windowY = (int)HIWORD(lParam)  break;//////In your game loopGetCursorPos(&pt);pt.x -= g_windowX;pt.y -= g_windowY;


[edited by - Hedos on March 19, 2004 10:13:59 PM]
thank you very much! (but the last part was obvious )

This topic is closed to new replies.

Advertisement