public unsafe void HIWORD_x64_Result() { Assert.Equal(0x0102, PARAM.HIWORD(unchecked ((nint)0x0506070801020304))); Assert.Equal(0xF1F2, PARAM.HIWORD(unchecked ((nint)0xF5F6F7F8F1F2F3F4))); }
/// <summary> /// The AdornerWindow intercepts all designer-related messages and forwards them to the BehaviorService /// for appropriate actions. Note that Paint and HitTest messages are correctly parsed and translated /// to AdornerWindow coords. /// </summary> protected override void WndProc(ref Message m) { //special test hooks if (m.Msg == (int)WM_GETALLSNAPLINES) { _behaviorService.TestHook_GetAllSnapLines(ref m); } else if (m.Msg == (int)WM_GETRECENTSNAPLINES) { _behaviorService.TestHook_GetRecentSnapLines(ref m); } switch ((User32.WM)m.Msg) { case User32.WM.PAINT: { // Stash off the region we have to update. using var hrgn = new Gdi32.RegionScope(0, 0, 0, 0); User32.GetUpdateRgn(m.HWnd, hrgn, BOOL.TRUE); // The region we have to update in terms of the smallest rectangle that completely encloses // the update region of the window gives us the clip rectangle. RECT clip = new RECT(); User32.GetUpdateRect(m.HWnd, ref clip, BOOL.TRUE); Rectangle paintRect = clip; using Region region = hrgn.CreateGdiPlusRegion(); // Call the base class to do its painting. DefWndProc(ref m); // Now do our own painting. using Graphics g = Graphics.FromHwnd(m.HWnd); using PaintEventArgs pevent = new PaintEventArgs(g, paintRect); g.Clip = region; _behaviorService.PropagatePaint(pevent); break; } case User32.WM.NCHITTEST: Point pt = new Point( (short)PARAM.LOWORD(m.LParam), (short)PARAM.HIWORD(m.LParam)); var pt1 = new Point(); User32.MapWindowPoints(IntPtr.Zero, Handle, ref pt1, 1); pt.Offset(pt1.X, pt1.Y); if (_behaviorService.PropagateHitTest(pt) && !ProcessingDrag) { m.Result = (IntPtr)User32.HT.TRANSPARENT; } else { m.Result = (IntPtr)User32.HT.CLIENT; } break; case User32.WM.CAPTURECHANGED: base.WndProc(ref m); _behaviorService.OnLoseCapture(); break; default: base.WndProc(ref m); break; } }
public unsafe void HIWORD_x32_Result() { Assert.Equal(0x0102, PARAM.HIWORD((nint)0x01020304)); Assert.Equal(0xF1F2, PARAM.HIWORD(unchecked ((nint)0xF1F2F3F4))); }