How do I read the Win32 WM_MOVE lParam x,y coordinates in C#?
See the question and my original answer on StackOverflow.NET Reference source is a gold mine. In an internal System.Windows.Forms.NativeMethods+Util class you will find these helpers, that talk the same as WM_MOVE documentation (high-order word = HIWORD, low-order word = LOWORD, etc.)
public static int MAKELONG(int low, int high) {
return (high << 16) | (low & 0xffff);
}
public static IntPtr MAKELPARAM(int low, int high) {
return (IntPtr) ((high << 16) | (low & 0xffff));
}
public static int HIWORD(int n) {
return (n >> 16) & 0xffff;
}
public static int HIWORD(IntPtr n) {
return HIWORD( unchecked((int)(long)n) );
}
public static int LOWORD(int n) {
return n & 0xffff;
}
public static int LOWORD(IntPtr n) {
return LOWORD( unchecked((int)(long)n) );
}
public static int SignedHIWORD(IntPtr n) {
return SignedHIWORD( unchecked((int)(long)n) );
}
public static int SignedLOWORD(IntPtr n) {
return SignedLOWORD( unchecked((int)(long)n) );
}
public static int SignedHIWORD(int n) {
int i = (int)(short)((n >> 16) & 0xffff);
return i;
}
public static int SignedLOWORD(int n) {
int i = (int)(short)(n & 0xFFFF);
return i;
}