Reputation: 5
MSG Message Structure:
typedef struct tagMSG {
HWND hwnd;
UINT message;
WPARAM wParam;
LPARAM lParam;
DWORD time;
POINT pt;
#ifdef _MAC
DWORD lPrivate;
#endif
} MSG, *PMSG, NEAR *NPMSG, FAR *LPMSG;
Why is it necessary to store cursor coordinates in a separate field if cursor coordinates are stored in lParam for mouse operation events?
Upvotes: 0
Views: 138
Reputation: 101746
As noted in the comments, the current "global" mouse cursor position might not be the same as the position at the time the message was generated. The threads message queue keeps track of the time and mouse position from the window/threads point of view and simply reports it as part of the data retrieved by GetMessage
.
This position can also be retried by code that does not have direct access to the MSG
by calling GetMessagePos
(and GetMessageTime
).
Upvotes: 1