MousePosition vs lParam
-
Why values are not same? I simple want to find the position of Cursor through LParam. But calculated values are different.
Point screenMousePointOld = Control.MousePosition; Point screenMousePoint = new Point(LoWord(message.LParam.ToInt32()), HiWord(message.LParam.ToInt32()));
private static int HiWord(int number) { if ((number & 0x80000000) == 0x80000000) return (number >> 16); else return (number >> 16) & 0xffff ; } private static int LoWord(int number) { return number & 0xffff; }
What I am doing wrong? -
Why values are not same? I simple want to find the position of Cursor through LParam. But calculated values are different.
Point screenMousePointOld = Control.MousePosition; Point screenMousePoint = new Point(LoWord(message.LParam.ToInt32()), HiWord(message.LParam.ToInt32()));
private static int HiWord(int number) { if ((number & 0x80000000) == 0x80000000) return (number >> 16); else return (number >> 16) & 0xffff ; } private static int LoWord(int number) { return number & 0xffff; }
What I am doing wrong?