G
Guest
Hi,
I've found online a piece of code to extract the mouse pointer coordinates
in C#:
// msg = System.Windows.Form.Message
int x = (short)((uint)msg.LParam & 0x0000FFFF);
int y = (short)(((uint)msg.LParam & 0xFFFF0000) >> 16);
Unfortunately the code doesn't have much comments on it. Can anyone please
explain how mouse pointer coordinates is constructed and stored in LParam?
Why masks it with 0x0000FFFF or 0xFFFF0000, then right shift 16 times?
Please help, thanks!
-P
I've found online a piece of code to extract the mouse pointer coordinates
in C#:
// msg = System.Windows.Form.Message
int x = (short)((uint)msg.LParam & 0x0000FFFF);
int y = (short)(((uint)msg.LParam & 0xFFFF0000) >> 16);
Unfortunately the code doesn't have much comments on it. Can anyone please
explain how mouse pointer coordinates is constructed and stored in LParam?
Why masks it with 0x0000FFFF or 0xFFFF0000, then right shift 16 times?
Please help, thanks!
-P