private static void RaiseNonClientMouseMessageAsClient(IntPtr hwnd, int msg, IntPtr lparam) { var point = new Core.Platform.Point { X = NativeMethods.GetXlParam(lparam.ToInt32()), Y = NativeMethods.GetYlParam(lparam.ToInt32()) }; NativeMethods.ScreenToClient(hwnd, ref point); NativeMethods.SendMessage(hwnd, msg + 513 - 161, new IntPtr(PressedMouseButtons), NativeMethods.MakeParam(point.X, point.Y)); }