コード例 #1
0
        private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
        {
            switch (msg)
            {
            case 126:
                if (IsVisible)
                {
                    RenderLayeredWindow();
                }
                break;

            case 33:
                handled = true;
                return(new IntPtr(3));

            case 132:
                Cursor = GetCursor(lParam) ?? Cursors.None;
                break;

            case 161:
            case 163:
            case 164:
            case 166:
            case 167:
            case 169:
            case 171:
            case 173:
                var targetWindowHandle = TargetWindowHandle;
                NativeMethods.SendMessage(targetWindowHandle, 6, new IntPtr(2), IntPtr.Zero);
                NativeMethods.SendMessage(targetWindowHandle, msg, wParam, IntPtr.Zero);
                break;

            case 6:
                return(IntPtr.Zero);

            case 70:
                var windowPos = (Windowpos)Marshal.PtrToStructure(lParam, typeof(Windowpos));
                windowPos.flags |= 16U;
                Marshal.StructureToPtr(windowPos, lParam, true);
                break;

            case 513:
                if (!IsHitTestVisible)
                {
                    break;
                }
                var pt = new Point((int)lParam & 0xFFFF, ((int)lParam >> 16) & 0xFFFF);
                NativeMethods.PostMessage(TargetWindowHandle,
                                          161, (IntPtr)DecideResizeDirection(pt),
                                          IntPtr.Zero);
                break;
            }
            return(NativeMethods.DefWindowProc(hwnd, msg, wParam, lParam));
        }
コード例 #2
0
 private static IntPtr WmNcActivate(IntPtr hWnd, IntPtr wParam, ref bool handled)
 {
     handled = true;
     return(NativeMethods.DefWindowProc(hWnd, 134, wParam, new IntPtr(-1)));
 }