首页 > 代码库 > [WPF疑难]避免窗口最大化时遮盖任务栏

[WPF疑难]避免窗口最大化时遮盖任务栏

 转载:http://www.cnblogs.com/zhouyinhui/archive/2008/11/04/1326188.html

 

WPF窗口最大化时有个很不好的现象是:如果窗口的WindowStyle被直接或间接地设置为None后(比如很多情况下你会覆盖默认的窗体样式,即不采用Windows默认的边框和最大化最等按钮,来打造个性的窗体),那么最大化窗口后,窗口将铺满整个屏幕而将任务栏盖住。这往往不符合实际要求。

这里有个不错的解决方案解决了该问题,其通过对 WM_GETMINMAXINFO(MSDN: The WM_GETMINMAXINFO message is sent to a window when the size or position of the window is about to change. An application can use this message to override the window‘s default maximized size and position, or its default minimum or maximum tracking size.) 消息挂接一个钩子来处理。其消息代码是:0x0024(更多的消息代码可以参考本文附录)

没什么好说的,直接上代码(对你要处理的窗口调用FullScreenManager.RepairWpfWindowFullScreenBehavior方法即可):

public static class FullScreenManager
    {
        public static void RepairWpfWindowFullScreenBehavior(Window wpfWindow)
        {
            if(wpfWindow == null)
            {
                return;
            }

            if(wpfWindow.WindowState == WindowState.Maximized)
            {
                wpfWindow.WindowState = WindowState.Normal;
                wpfWindow.Loaded += delegate { wpfWindow.WindowState = WindowState.Maximized; };
            }

            wpfWindow.SourceInitialized += delegate
            {
                IntPtr handle = (new WindowInteropHelper(wpfWindow)).Handle;
                HwndSource source = HwndSource.FromHwnd(handle);
                if(source != null)
                {
                    source.AddHook(WindowProc);
                }
            };
        }

        private static IntPtr WindowProc(IntPtr hwnd,  int msg,  IntPtr wParam, IntPtr lParam, ref bool handled)
        {
            switch (msg)
            {
                case 0x0024:
                    WmGetMinMaxInfo(hwnd, lParam);
                    handled = true;
                    break;
            }

            return (IntPtr) 0;
        }

        private static void WmGetMinMaxInfo(IntPtr hwnd, IntPtr lParam)
        {
            var mmi = (MINMAXINFO)Marshal.PtrToStructure(lParam, typeof(MINMAXINFO));

            // Adjust the maximized size and position to fit the work area of the correct monitor
            int MONITOR_DEFAULTTONEAREST = 0x00000002;
            IntPtr monitor = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST);

            if (monitor != IntPtr.Zero)
            {
                var monitorInfo = new MONITORINFO();
                GetMonitorInfo(monitor, monitorInfo);
                RECT rcWorkArea = monitorInfo.rcWork;
                RECT rcMonitorArea = monitorInfo.rcMonitor;
                mmi.ptMaxPosition.x = Math.Abs(rcWorkArea.left - rcMonitorArea.left);
                mmi.ptMaxPosition.y = Math.Abs(rcWorkArea.top - rcMonitorArea.top);
                mmi.ptMaxSize.x = Math.Abs(rcWorkArea.right - rcWorkArea.left);
                mmi.ptMaxSize.y = Math.Abs(rcWorkArea.bottom - rcWorkArea.top);
            }

            Marshal.StructureToPtr(mmi, lParam, true);
        }


        [DllImport("user32")]
        internal static extern bool GetMonitorInfo(IntPtr hMonitor, MONITORINFO lpmi);

        /// <summary>
        /// 
        /// </summary>
        [DllImport("User32")]
        internal static extern IntPtr MonitorFromWindow(IntPtr handle, int flags);

        #region Nested type: MINMAXINFO

        [StructLayout(LayoutKind.Sequential)]
        internal struct MINMAXINFO
        {
            public POINT ptReserved;
            public POINT ptMaxSize;
            public POINT ptMaxPosition;
            public POINT ptMinTrackSize;
            public POINT ptMaxTrackSize;
        } ;

        #endregion

        #region Nested type: MONITORINFO

        /// <summary>
        /// </summary>
        [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
        internal class MONITORINFO
        {
            /// <summary>
            /// </summary>            
            public int cbSize = Marshal.SizeOf(typeof(MONITORINFO));

            /// <summary>
            /// </summary>            
            public RECT rcMonitor;

            /// <summary>
            /// </summary>            
            public RECT rcWork;

            /// <summary>
            /// </summary>            
            public int dwFlags;
        }

        #endregion

        #region Nested type: POINT

        /// <summary>
        /// POINT aka POINTAPI
        /// </summary>
        [StructLayout(LayoutKind.Sequential)]
        internal struct POINT
        {
            /// <summary>
            /// x coordinate of point.
            /// </summary>
            public int x;

            /// <summary>
            /// y coordinate of point.
            /// </summary>
            public int y;

            /// <summary>
            /// Construct a point of coordinates (x,y).
            /// </summary>
            public POINT(int x, int y)
            {
                this.x = x;
                this.y = y;
            }
        }

        #endregion

        #region Nested type: RECT

        /// <summary> Win32 </summary>
        [StructLayout(LayoutKind.Sequential, Pack = 0)]
        internal struct RECT
        {
            /// <summary> Win32 </summary>
            public int left;

            /// <summary> Win32 </summary>
            public int top;

            /// <summary> Win32 </summary>
            public int right;

            /// <summary> Win32 </summary>
            public int bottom;

            /// <summary> Win32 </summary>
            public static readonly RECT Empty;

            /// <summary> Win32 </summary>
            public int Width
            {
                get { return Math.Abs(right - left); } // Abs needed for BIDI OS
            }

            /// <summary> Win32 </summary>
            public int Height
            {
                get { return bottom - top; }
            }

            /// <summary> Win32 </summary>
            public RECT(int left, int top, int right, int bottom)
            {
                this.left = left;
                this.top = top;
                this.right = right;
                this.bottom = bottom;
            }


            /// <summary> Win32 </summary>
            public RECT(RECT rcSrc)
            {
                left = rcSrc.left;
                top = rcSrc.top;
                right = rcSrc.right;
                bottom = rcSrc.bottom;
            }

            /// <summary> Win32 </summary>
            public bool IsEmpty
            {
                get
                {
                    // BUGBUG : On Bidi OS (hebrew arabic) left > right
                    return left >= right || top >= bottom;
                }
            }

            /// <summary> Return a user friendly representation of this struct </summary>
            public override string ToString()
            {
                if (this == Empty)
                {
                    return "RECT {Empty}";
                }
                return "RECT { left : " + left + " / top : " + top + " / right : " + right + " / bottom : " + bottom +
                       " }";
            }

            /// <summary> Determine if 2 RECT are equal (deep compare) </summary>
            public override bool Equals(object obj)
            {
                if (!(obj is Rect))
                {
                    return false;
                }
                return (this == (RECT)obj);
            }

            /// <summary>Return the HashCode for this struct (not garanteed to be unique)</summary>
            public override int GetHashCode()
            {
                return left.GetHashCode() + top.GetHashCode() + right.GetHashCode() + bottom.GetHashCode();
            }


            /// <summary> Determine if 2 RECT are equal (deep compare)</summary>
            public static bool operator ==(RECT rect1, RECT rect2)
            {
                return (rect1.left == rect2.left && rect1.top == rect2.top && rect1.right == rect2.right &&
                        rect1.bottom == rect2.bottom);
            }

            /// <summary> Determine if 2 RECT are different(deep compare)</summary>
            public static bool operator !=(RECT rect1, RECT rect2)
            {
                return !(rect1 == rect2);
            }
        }

        #endregion
    } 

 

------------------------------------------

附录:

 

Windows Message Codes

Sorted by NameSorted by Code

 

MessageCode CodeMessage
WM_ACTIVATE0x0006 0x0000WM_NULL
WM_ACTIVATEAPP0x001C 0x0001WM_CREATE
WM_AFXFIRST0x0360 0x0002WM_DESTROY
WM_AFXLAST0x037F 0x0003WM_MOVE
WM_APP0x8000 0x0005WM_SIZE
WM_APPCOMMAND0x0319 0x0006WM_ACTIVATE
WM_ASKCBFORMATNAME0x030C 0x0007WM_SETFOCUS
WM_CANCELJOURNAL0x004B 0x0008WM_KILLFOCUS
WM_CANCELMODE0x001F 0x000AWM_ENABLE
WM_CAPTURECHANGED0x0215 0x000BWM_SETREDRAW
WM_CHANGECBCHAIN0x030D 0x000CWM_SETTEXT
WM_CHANGEUISTATE0x0127 0x000DWM_GETTEXT
WM_CHAR0x0102 0x000EWM_GETTEXTLENGTH
WM_CHARTOITEM0x002F 0x000FWM_PAINT
WM_CHILDACTIVATE0x0022 0x0010WM_CLOSE
WM_CLEAR0x0303 0x0011WM_QUERYENDSESSION
WM_CLOSE0x0010 0x0013WM_QUERYOPEN
WM_COMMAND0x0111 0x0016WM_ENDSESSION
WM_COMMNOTIFY0x0044 0x0012WM_QUIT
WM_COMPACTING0x0041 0x0014WM_ERASEBKGND
WM_COMPAREITEM0x0039 0x0015WM_SYSCOLORCHANGE
WM_CONTEXTMENU0x007B 0x0018WM_SHOWWINDOW
WM_COPY0x0301 0x001AWM_WININICHANGE
WM_COPYDATA0x004A 0x001AWM_SETTINGCHANGE
WM_CREATE0x0001 0x001BWM_DEVMODECHANGE
WM_CTLCOLORBTN0x0135 0x001CWM_ACTIVATEAPP
WM_CTLCOLORDLG0x0136 0x001DWM_FONTCHANGE
WM_CTLCOLOREDIT0x0133 0x001EWM_TIMECHANGE
WM_CTLCOLORLISTBOX0x0134 0x001FWM_CANCELMODE
WM_CTLCOLORMSGBOX0x0132 0x0020WM_SETCURSOR
WM_CTLCOLORSCROLLBAR0x0137 0x0021WM_MOUSEACTIVATE
WM_CTLCOLORSTATIC0x0138 0x0022WM_CHILDACTIVATE
WM_CUT0x0300 0x0023WM_QUEUESYNC
WM_DEADCHAR0x0103 0x0024WM_GETMINMAXINFO
WM_DELETEITEM0x002D 0x0026WM_PAINTICON
WM_DESTROY0x0002 0x0027WM_ICONERASEBKGND
WM_DESTROYCLIPBOARD0x0307 0x0028WM_NEXTDLGCTL
WM_DEVICECHANGE0x0219 0x002AWM_SPOOLERSTATUS
WM_DEVMODECHANGE0x001B 0x002BWM_DRAWITEM
WM_DISPLAYCHANGE0x007E 0x002CWM_MEASUREITEM
WM_DRAWCLIPBOARD0x0308 0x002DWM_DELETEITEM
WM_DRAWITEM0x002B 0x002EWM_VKEYTOITEM
WM_DROPFILES0x0233 0x002FWM_CHARTOITEM
WM_ENABLE0x000A 0x0030WM_SETFONT
WM_ENDSESSION0x0016 0x0031WM_GETFONT
WM_ENTERIDLE0x0121 0x0032WM_SETHOTKEY
WM_ENTERMENULOOP0x0211 0x0033WM_GETHOTKEY
WM_ENTERSIZEMOVE0x0231 0x0037WM_QUERYDRAGICON
WM_ERASEBKGND0x0014 0x0039WM_COMPAREITEM
WM_EXITMENULOOP0x0212 0x003DWM_GETOBJECT
WM_EXITSIZEMOVE0x0232 0x0041WM_COMPACTING
WM_FONTCHANGE0x001D 0x0044WM_COMMNOTIFY
WM_GETDLGCODE0x0087 0x0046WM_WINDOWPOSCHANGING
WM_GETFONT0x0031 0x0047WM_WINDOWPOSCHANGED
WM_GETHOTKEY0x0033 0x0048WM_POWER
WM_GETICON0x007F 0x004AWM_COPYDATA
WM_GETMINMAXINFO0x0024 0x004BWM_CANCELJOURNAL
WM_GETOBJECT0x003D 0x004EWM_NOTIFY
WM_GETTEXT0x000D 0x0050WM_INPUTLANGCHANGEREQUEST
WM_GETTEXTLENGTH0x000E 0x0051WM_INPUTLANGCHANGE
WM_HANDHELDFIRST0x0358 0x0052WM_TCARD
WM_HANDHELDLAST0x035F 0x0053WM_HELP
WM_HELP0x0053 0x0054WM_USERCHANGED
WM_HOTKEY0x0312 0x0055WM_NOTIFYFORMAT
WM_HSCROLL0x0114 0x007BWM_CONTEXTMENU
WM_HSCROLLCLIPBOARD0x030E 0x007CWM_STYLECHANGING
WM_ICONERASEBKGND0x0027 0x007DWM_STYLECHANGED
WM_IME_CHAR0x0286 0x007EWM_DISPLAYCHANGE
WM_IME_COMPOSITION0x010F 0x007FWM_GETICON
WM_IME_COMPOSITIONFULL0x0284 0x0080WM_SETICON
WM_IME_CONTROL0x0283 0x0081WM_NCCREATE
WM_IME_ENDCOMPOSITION0x010E 0x0082WM_NCDESTROY
WM_IME_KEYDOWN0x0290 0x0083WM_NCCALCSIZE
WM_IME_KEYLAST0x010F 0x0084WM_NCHITTEST
WM_IME_KEYUP0x0291 0x0085WM_NCPAINT
WM_IME_NOTIFY0x0282 0x0086WM_NCACTIVATE
WM_IME_REQUEST0x0288 0x0087WM_GETDLGCODE
WM_IME_SELECT0x0285 0x0088WM_SYNCPAINT
WM_IME_SETCONTEXT0x0281 0x00A0WM_NCMOUSEMOVE
WM_IME_STARTCOMPOSITION0x010D 0x00A1WM_NCLBUTTONDOWN
WM_INITDIALOG0x0110 0x00A2WM_NCLBUTTONUP
WM_INITMENU0x0116 0x00A3WM_NCLBUTTONDBLCLK
WM_INITMENUPOPUP0x0117 0x00A4WM_NCRBUTTONDOWN
WM_INPUT0x00FF 0x00A5WM_NCRBUTTONUP
WM_INPUTLANGCHANGE0x0051 0x00A6WM_NCRBUTTONDBLCLK
WM_INPUTLANGCHANGEREQUEST0x0050 0x00A7WM_NCMBUTTONDOWN
WM_KEYDOWN0x0100 0x00A8WM_NCMBUTTONUP
WM_KEYFIRST0x0100 0x00A9WM_NCMBUTTONDBLCLK
WM_KEYLAST0x0108 0x00ABWM_NCXBUTTONDOWN
WM_KEYLAST0x0109 0x00ACWM_NCXBUTTONUP
WM_KEYUP0x0101 0x00ADWM_NCXBUTTONDBLCLK
WM_KILLFOCUS0x0008 0x00FFWM_INPUT
WM_LBUTTONDBLCLK0x0203 0x0100WM_KEYFIRST
WM_LBUTTONDOWN0x0201 0x0100WM_KEYDOWN
WM_LBUTTONUP0x0202 0x0101WM_KEYUP
WM_MBUTTONDBLCLK0x0209 0x0102WM_CHAR
WM_MBUTTONDOWN0x0207 0x0103WM_DEADCHAR
WM_MBUTTONUP0x0208 0x0104WM_SYSKEYDOWN
WM_MDIACTIVATE0x0222 0x0105WM_SYSKEYUP
WM_MDICASCADE0x0227 0x0106WM_SYSCHAR
WM_MDICREATE0x0220 0x0107WM_SYSDEADCHAR
WM_MDIDESTROY0x0221 0x0109WM_UNICHAR
WM_MDIGETACTIVE0x0229 0x0109WM_KEYLAST
WM_MDIICONARRANGE0x0228 0x0108WM_KEYLAST
WM_MDIMAXIMIZE0x0225 0x010DWM_IME_STARTCOMPOSITION
WM_MDINEXT0x0224 0x010EWM_IME_ENDCOMPOSITION
WM_MDIREFRESHMENU0x0234 0x010FWM_IME_COMPOSITION
WM_MDIRESTORE0x0223 0x010FWM_IME_KEYLAST
WM_MDISETMENU0x0230 0x0110WM_INITDIALOG
WM_MDITILE0x0226 0x0111WM_COMMAND
WM_MEASUREITEM0x002C 0x0112WM_SYSCOMMAND
WM_MENUCHAR0x0120 0x0113WM_TIMER
WM_MENUCOMMAND0x0126 0x0114WM_HSCROLL
WM_MENUDRAG0x0123 0x0115WM_VSCROLL
WM_MENUGETOBJECT0x0124 0x0116WM_INITMENU
WM_MENURBUTTONUP0x0122 0x0117WM_INITMENUPOPUP
WM_MENUSELECT0x011F 0x011FWM_MENUSELECT
WM_MOUSEACTIVATE0x0021 0x0120WM_MENUCHAR
WM_MOUSEFIRST0x0200 0x0121WM_ENTERIDLE
WM_MOUSEHOVER0x02A1 0x0122WM_MENURBUTTONUP
WM_MOUSELAST(2K,XP,2k3)0x020D 0x0123WM_MENUDRAG
WM_MOUSELAST(95)0x0209 0x0124WM_MENUGETOBJECT
WM_MOUSELAST(NT4,98)0x020A 0x0125WM_UNINITMENUPOPUP
WM_MOUSELEAVE0x02A3 0x0126WM_MENUCOMMAND
WM_MOUSEMOVE0x0200 0x0127WM_CHANGEUISTATE
WM_MOUSEWHEEL0x020A 0x0128WM_UPDATEUISTATE
WM_MOVE0x0003 0x0129WM_QUERYUISTATE
WM_MOVING0x0216 0x0132WM_CTLCOLORMSGBOX
WM_NCACTIVATE0x0086 0x0133WM_CTLCOLOREDIT
WM_NCCALCSIZE0x0083 0x0134WM_CTLCOLORLISTBOX
WM_NCCREATE0x0081 0x0135WM_CTLCOLORBTN
WM_NCDESTROY0x0082 0x0136WM_CTLCOLORDLG
WM_NCHITTEST0x0084 0x0137WM_CTLCOLORSCROLLBAR
WM_NCLBUTTONDBLCLK0x00A3 0x0138WM_CTLCOLORSTATIC
WM_NCLBUTTONDOWN0x00A1 0x0200WM_MOUSEFIRST
WM_NCLBUTTONUP0x00A2 0x0200WM_MOUSEMOVE
WM_NCMBUTTONDBLCLK0x00A9 0x0201WM_LBUTTONDOWN
WM_NCMBUTTONDOWN0x00A7 0x0202WM_LBUTTONUP
WM_NCMBUTTONUP0x00A8 0x0203WM_LBUTTONDBLCLK
WM_NCMOUSEHOVER0x02A0 0x0204WM_RBUTTONDOWN
WM_NCMOUSELEAVE0x02A2 0x0205WM_RBUTTONUP
WM_NCMOUSEMOVE0x00A0 0x0206WM_RBUTTONDBLCLK
WM_NCPAINT0x0085 0x0207WM_MBUTTONDOWN
WM_NCRBUTTONDBLCLK0x00A6 0x0208WM_MBUTTONUP
WM_NCRBUTTONDOWN0x00A4 0x0209WM_MBUTTONDBLCLK
WM_NCRBUTTONUP0x00A5 0x0209WM_MOUSELAST(95)
WM_NCXBUTTONDBLCLK0x00AD 0x020AWM_MOUSEWHEEL
WM_NCXBUTTONDOWN0x00AB 0x020AWM_MOUSELAST(NT4,98)
WM_NCXBUTTONUP0x00AC 0x020BWM_XBUTTONDOWN
WM_NEXTDLGCTL0x0028 0x020CWM_XBUTTONUP
WM_NEXTMENU0x0213 0x020DWM_XBUTTONDBLCLK
WM_NOTIFY0x004E 0x020DWM_MOUSELAST(2K,XP,2k3)
WM_NOTIFYFORMAT0x0055 0x0210WM_PARENTNOTIFY
WM_NULL0x0000 0x0211WM_ENTERMENULOOP
WM_PAINT0x000F 0x0212WM_EXITMENULOOP
WM_PAINTCLIPBOARD0x0309 0x0213WM_NEXTMENU
WM_PAINTICON0x0026 0x0214WM_SIZING
WM_PALETTECHANGED0x0311 0x0215WM_CAPTURECHANGED
WM_PALETTEISCHANGING0x0310 0x0216WM_MOVING
WM_PARENTNOTIFY0x0210 0x0218WM_POWERBROADCAST
WM_PASTE0x0302 0x0219WM_DEVICECHANGE
WM_PENWINFIRST0x0380 0x0220WM_MDICREATE
WM_PENWINLAST0x038F 0x0221WM_MDIDESTROY
WM_POWER0x0048 0x0222WM_MDIACTIVATE
WM_POWERBROADCAST0x0218 0x0223WM_MDIRESTORE
WM_PRINT0x0317 0x0224WM_MDINEXT
WM_PRINTCLIENT0x0318 0x0225WM_MDIMAXIMIZE
WM_QUERYDRAGICON0x0037 0x0226WM_MDITILE
WM_QUERYENDSESSION0x0011 0x0227WM_MDICASCADE
WM_QUERYNEWPALETTE0x030F 0x0228WM_MDIICONARRANGE
WM_QUERYOPEN0x0013 0x0229WM_MDIGETACTIVE
WM_QUERYUISTATE0x0129 0x0230WM_MDISETMENU
WM_QUEUESYNC0x0023 0x0231WM_ENTERSIZEMOVE
WM_QUIT0x0012 0x0232WM_EXITSIZEMOVE
WM_RBUTTONDBLCLK0x0206 0x0233WM_DROPFILES
WM_RBUTTONDOWN0x0204 0x0234WM_MDIREFRESHMENU
WM_RBUTTONUP0x0205 0x0281WM_IME_SETCONTEXT
WM_RENDERALLFORMATS0x0306 0x0282WM_IME_NOTIFY
WM_RENDERFORMAT0x0305 0x0283WM_IME_CONTROL
WM_SETCURSOR0x0020 0x0284WM_IME_COMPOSITIONFULL
WM_SETFOCUS0x0007 0x0285WM_IME_SELECT
WM_SETFONT0x0030 0x0286WM_IME_CHAR
WM_SETHOTKEY0x0032 0x0288WM_IME_REQUEST
WM_SETICON0x0080 0x0290WM_IME_KEYDOWN
WM_SETREDRAW0x000B 0x0291WM_IME_KEYUP
WM_SETTEXT0x000C 0x02A1WM_MOUSEHOVER
WM_SETTINGCHANGE0x001A 0x02A3WM_MOUSELEAVE
WM_SHOWWINDOW0x0018 0x02A0WM_NCMOUSEHOVER
WM_SIZE0x0005 0x02A2WM_NCMOUSELEAVE
WM_SIZECLIPBOARD0x030B 0x02B1WM_WTSSESSION_CHANGE
WM_SIZING0x0214 0x02C0WM_TABLET_FIRST
WM_SPOOLERSTATUS0x002A 0x02DFWM_TABLET_LAST
WM_STYLECHANGED0x007D 0x0300WM_CUT
WM_STYLECHANGING0x007C 0x0301WM_COPY
WM_SYNCPAINT0x0088 0x0302WM_PASTE
WM_SYSCHAR0x0106 0x0303WM_CLEAR
WM_SYSCOLORCHANGE0x0015 0x0304WM_UNDO
WM_SYSCOMMAND0x0112 0x0305WM_RENDERFORMAT
WM_SYSDEADCHAR0x0107 0x0306WM_RENDERALLFORMATS
WM_SYSKEYDOWN0x0104 0x0307WM_DESTROYCLIPBOARD
WM_SYSKEYUP0x0105 0x0308WM_DRAWCLIPBOARD
WM_TABLET_FIRST0x02C0 0x0309WM_PAINTCLIPBOARD
WM_TABLET_LAST0x02DF 0x030AWM_VSCROLLCLIPBOARD
WM_TCARD0x0052 0x030BWM_SIZECLIPBOARD
WM_THEMECHANGED0x031A 0x030CWM_ASKCBFORMATNAME
WM_TIMECHANGE0x001E 0x030DWM_CHANGECBCHAIN
WM_TIMER0x0113 0x030EWM_HSCROLLCLIPBOARD
WM_UNDO0x0304 0x030FWM_QUERYNEWPALETTE
WM_UNICHAR0x0109 0x0310WM_PALETTEISCHANGING
WM_UNINITMENUPOPUP0x0125 0x0311WM_PALETTECHANGED
WM_UPDATEUISTATE0x0128 0x0312WM_HOTKEY
WM_USER0x0400 0x0317WM_PRINT
WM_USERCHANGED0x0054 0x0318WM_PRINTCLIENT
WM_VKEYTOITEM0x002E 0x0319WM_APPCOMMAND
WM_VSCROLL0x0115 0x031AWM_THEMECHANGED
WM_VSCROLLCLIPBOARD0x030A 0x0358WM_HANDHELDFIRST
WM_WINDOWPOSCHANGED0x0047 0x035FWM_HANDHELDLAST
WM_WINDOWPOSCHANGING0x0046 0x0360WM_AFXFIRST
WM_WININICHANGE0x001A 0x037FWM_AFXLAST
WM_WTSSESSION_CHANGE0x02B1 0x0380WM_PENWINFIRST
WM_XBUTTONDBLCLK0x020D 0x038FWM_PENWINLAST
WM_XBUTTONDOWN0x020B 0x0400WM_USER
WM_XBUTTONUP0x020C 0x8000WM_APP

[WPF疑难]避免窗口最大化时遮盖任务栏