internal static int HIWORD(IntPtr value) { int int32 = (((int)value.ToInt64() >> 0x10) & 0xFFFF); return (int32 > 32767) ? int32 - 65536 : int32; }