首页 > 编程语言 >【转】[C#][WPF] 避免窗口最大化时遮盖任务栏

【转】[C#][WPF] 避免窗口最大化时遮盖任务栏

时间:2024-09-12 17:52:14浏览次数:9  
标签:IME C# WM int WPF 任务栏 public RECT left

转自:https://learn.microsoft.com/zh-cn/previous-versions/msdn10/dd366102(v=MSDN.10)

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

Message

Code

 

Code

Message

WM_ACTIVATE

0x0006

 

0x0000

WM_NULL

WM_ACTIVATEAPP

0x001C

 

0x0001

WM_CREATE

WM_AFXFIRST

0x0360

 

0x0002

WM_DESTROY

WM_AFXLAST

0x037F

 

0x0003

WM_MOVE

WM_APP

0x8000

 

0x0005

WM_SIZE

WM_APPCOMMAND

0x0319

 

0x0006

WM_ACTIVATE

WM_ASKCBFORMATNAME

0x030C

 

0x0007

WM_SETFOCUS

WM_CANCELJOURNAL

0x004B

 

0x0008

WM_KILLFOCUS

WM_CANCELMODE

0x001F

 

0x000A

WM_ENABLE

WM_CAPTURECHANGED

0x0215

 

0x000B

WM_SETREDRAW

WM_CHANGECBCHAIN

0x030D

 

0x000C

WM_SETTEXT

WM_CHANGEUISTATE

0x0127

 

0x000D

WM_GETTEXT

WM_CHAR

0x0102

 

0x000E

WM_GETTEXTLENGTH

WM_CHARTOITEM

0x002F

 

0x000F

WM_PAINT

WM_CHILDACTIVATE

0x0022

 

0x0010

WM_CLOSE

WM_CLEAR

0x0303

 

0x0011

WM_QUERYENDSESSION

WM_CLOSE

0x0010

 

0x0013

WM_QUERYOPEN

WM_COMMAND

0x0111

 

0x0016

WM_ENDSESSION

WM_COMMNOTIFY

0x0044

 

0x0012

WM_QUIT

WM_COMPACTING

0x0041

 

0x0014

WM_ERASEBKGND

WM_COMPAREITEM

0x0039

 

0x0015

WM_SYSCOLORCHANGE

WM_CONTEXTMENU

0x007B

 

0x0018

WM_SHOWWINDOW

WM_COPY

0x0301

 

0x001A

WM_WININICHANGE

WM_COPYDATA

0x004A

 

0x001A

WM_SETTINGCHANGE

WM_CREATE

0x0001

 

0x001B

WM_DEVMODECHANGE

WM_CTLCOLORBTN

0x0135

 

0x001C

WM_ACTIVATEAPP

WM_CTLCOLORDLG

0x0136

 

0x001D

WM_FONTCHANGE

WM_CTLCOLOREDIT

0x0133

 

0x001E

WM_TIMECHANGE

WM_CTLCOLORLISTBOX

0x0134

 

0x001F

WM_CANCELMODE

WM_CTLCOLORMSGBOX

0x0132

 

0x0020

WM_SETCURSOR

WM_CTLCOLORSCROLLBAR

0x0137

 

0x0021

WM_MOUSEACTIVATE

WM_CTLCOLORSTATIC

0x0138

 

0x0022

WM_CHILDACTIVATE

WM_CUT

0x0300

 

0x0023

WM_QUEUESYNC

WM_DEADCHAR

0x0103

 

0x0024

WM_GETMINMAXINFO

WM_DELETEITEM

0x002D

 

0x0026

WM_PAINTICON

WM_DESTROY

0x0002

 

0x0027

WM_ICONERASEBKGND

WM_DESTROYCLIPBOARD

0x0307

 

0x0028

WM_NEXTDLGCTL

WM_DEVICECHANGE

0x0219

 

0x002A

WM_SPOOLERSTATUS

WM_DEVMODECHANGE

0x001B

 

0x002B

WM_DRAWITEM

WM_DISPLAYCHANGE

0x007E

 

0x002C

WM_MEASUREITEM

WM_DRAWCLIPBOARD

0x0308

 

0x002D

WM_DELETEITEM

WM_DRAWITEM

0x002B

 

0x002E

WM_VKEYTOITEM

WM_DROPFILES

0x0233

 

0x002F

WM_CHARTOITEM

WM_ENABLE

0x000A

 

0x0030

WM_SETFONT

WM_ENDSESSION

0x0016

 

0x0031

WM_GETFONT

WM_ENTERIDLE

0x0121

 

0x0032

WM_SETHOTKEY

WM_ENTERMENULOOP

0x0211

 

0x0033

WM_GETHOTKEY

WM_ENTERSIZEMOVE

0x0231

 

0x0037

WM_QUERYDRAGICON

WM_ERASEBKGND

0x0014

 

0x0039

WM_COMPAREITEM

WM_EXITMENULOOP

0x0212

 

0x003D

WM_GETOBJECT

WM_EXITSIZEMOVE

0x0232

 

0x0041

WM_COMPACTING

WM_FONTCHANGE

0x001D

 

0x0044

WM_COMMNOTIFY

WM_GETDLGCODE

0x0087

 

0x0046

WM_WINDOWPOSCHANGING

WM_GETFONT

0x0031

 

0x0047

WM_WINDOWPOSCHANGED

WM_GETHOTKEY

0x0033

 

0x0048

WM_POWER

WM_GETICON

0x007F

 

0x004A

WM_COPYDATA

WM_GETMINMAXINFO

0x0024

 

0x004B

WM_CANCELJOURNAL

WM_GETOBJECT

0x003D

 

0x004E

WM_NOTIFY

WM_GETTEXT

0x000D

 

0x0050

WM_INPUTLANGCHANGEREQUEST

WM_GETTEXTLENGTH

0x000E

 

0x0051

WM_INPUTLANGCHANGE

WM_HANDHELDFIRST

0x0358

 

0x0052

WM_TCARD

WM_HANDHELDLAST

0x035F

 

0x0053

WM_HELP

WM_HELP

0x0053

 

0x0054

WM_USERCHANGED

WM_HOTKEY

0x0312

 

0x0055

WM_NOTIFYFORMAT

WM_HSCROLL

0x0114

 

0x007B

WM_CONTEXTMENU

WM_HSCROLLCLIPBOARD

0x030E

 

0x007C

WM_STYLECHANGING

WM_ICONERASEBKGND

0x0027

 

0x007D

WM_STYLECHANGED

WM_IME_CHAR

0x0286

 

0x007E

WM_DISPLAYCHANGE

WM_IME_COMPOSITION

0x010F

 

0x007F

WM_GETICON

WM_IME_COMPOSITIONFULL

0x0284

 

0x0080

WM_SETICON

WM_IME_CONTROL

0x0283

 

0x0081

WM_NCCREATE

WM_IME_ENDCOMPOSITION

0x010E

 

0x0082

WM_NCDESTROY

WM_IME_KEYDOWN

0x0290

 

0x0083

WM_NCCALCSIZE

WM_IME_KEYLAST

0x010F

 

0x0084

WM_NCHITTEST

WM_IME_KEYUP

0x0291

 

0x0085

WM_NCPAINT

WM_IME_NOTIFY

0x0282

 

0x0086

WM_NCACTIVATE

WM_IME_REQUEST

0x0288

 

0x0087

WM_GETDLGCODE

WM_IME_SELECT

0x0285

 

0x0088

WM_SYNCPAINT

WM_IME_SETCONTEXT

0x0281

 

0x00A0

WM_NCMOUSEMOVE

WM_IME_STARTCOMPOSITION

0x010D

 

0x00A1

WM_NCLBUTTONDOWN

WM_INITDIALOG

0x0110

 

0x00A2

WM_NCLBUTTONUP

WM_INITMENU

0x0116

 

0x00A3

WM_NCLBUTTONDBLCLK

WM_INITMENUPOPUP

0x0117

 

0x00A4

WM_NCRBUTTONDOWN

WM_INPUT

0x00FF

 

0x00A5

WM_NCRBUTTONUP

WM_INPUTLANGCHANGE

0x0051

 

0x00A6

WM_NCRBUTTONDBLCLK

WM_INPUTLANGCHANGEREQUEST

0x0050

 

0x00A7

WM_NCMBUTTONDOWN

WM_KEYDOWN

0x0100

 

0x00A8

WM_NCMBUTTONUP

WM_KEYFIRST

0x0100

 

0x00A9

WM_NCMBUTTONDBLCLK

WM_KEYLAST

0x0108

 

0x00AB

WM_NCXBUTTONDOWN

WM_KEYLAST

0x0109

 

0x00AC

WM_NCXBUTTONUP

WM_KEYUP

0x0101

 

0x00AD

WM_NCXBUTTONDBLCLK

WM_KILLFOCUS

0x0008

 

0x00FF

WM_INPUT

WM_LBUTTONDBLCLK

0x0203

 

0x0100

WM_KEYFIRST

WM_LBUTTONDOWN

0x0201

 

0x0100

WM_KEYDOWN

WM_LBUTTONUP

0x0202

 

0x0101

WM_KEYUP

WM_MBUTTONDBLCLK

0x0209

 

0x0102

WM_CHAR

WM_MBUTTONDOWN

0x0207

 

0x0103

WM_DEADCHAR

WM_MBUTTONUP

0x0208

 

0x0104

WM_SYSKEYDOWN

WM_MDIACTIVATE

0x0222

 

0x0105

WM_SYSKEYUP

WM_MDICASCADE

0x0227

 

0x0106

WM_SYSCHAR

WM_MDICREATE

0x0220

 

0x0107

WM_SYSDEADCHAR

WM_MDIDESTROY

0x0221

 

0x0109

WM_UNICHAR

WM_MDIGETACTIVE

0x0229

 

0x0109

WM_KEYLAST

WM_MDIICONARRANGE

0x0228

 

0x0108

WM_KEYLAST

WM_MDIMAXIMIZE

0x0225

 

0x010D

WM_IME_STARTCOMPOSITION

WM_MDINEXT

0x0224

 

0x010E

WM_IME_ENDCOMPOSITION

WM_MDIREFRESHMENU

0x0234

 

0x010F

WM_IME_COMPOSITION

WM_MDIRESTORE

0x0223

 

0x010F

WM_IME_KEYLAST

WM_MDISETMENU

0x0230

 

0x0110

WM_INITDIALOG

WM_MDITILE

0x0226

 

0x0111

WM_COMMAND

WM_MEASUREITEM

0x002C

 

0x0112

WM_SYSCOMMAND

WM_MENUCHAR

0x0120

 

0x0113

WM_TIMER

WM_MENUCOMMAND

0x0126

 

0x0114

WM_HSCROLL

WM_MENUDRAG

0x0123

 

0x0115

WM_VSCROLL

WM_MENUGETOBJECT

0x0124

 

0x0116

WM_INITMENU

WM_MENURBUTTONUP

0x0122

 

0x0117

WM_INITMENUPOPUP

WM_MENUSELECT

0x011F

 

0x011F

WM_MENUSELECT

WM_MOUSEACTIVATE

0x0021

 

0x0120

WM_MENUCHAR

WM_MOUSEFIRST

0x0200

 

0x0121

WM_ENTERIDLE

WM_MOUSEHOVER

0x02A1

 

0x0122

WM_MENURBUTTONUP

WM_MOUSELAST(2K,XP,2k3)

0x020D

 

0x0123

WM_MENUDRAG

WM_MOUSELAST(95)

0x0209

 

0x0124

WM_MENUGETOBJECT

WM_MOUSELAST(NT4,98)

0x020A

 

0x0125

WM_UNINITMENUPOPUP

WM_MOUSELEAVE

0x02A3

 

0x0126

WM_MENUCOMMAND

WM_MOUSEMOVE

0x0200

 

0x0127

WM_CHANGEUISTATE

WM_MOUSEWHEEL

0x020A

 

0x0128

WM_UPDATEUISTATE

WM_MOVE

0x0003

 

0x0129

WM_QUERYUISTATE

WM_MOVING

0x0216

 

0x0132

WM_CTLCOLORMSGBOX

WM_NCACTIVATE

0x0086

 

0x0133

WM_CTLCOLOREDIT

WM_NCCALCSIZE

0x0083

 

0x0134

WM_CTLCOLORLISTBOX

WM_NCCREATE

0x0081

 

0x0135

WM_CTLCOLORBTN

WM_NCDESTROY

0x0082

 

0x0136

WM_CTLCOLORDLG

WM_NCHITTEST

0x0084

 

0x0137

WM_CTLCOLORSCROLLBAR

WM_NCLBUTTONDBLCLK

0x00A3

 

0x0138

WM_CTLCOLORSTATIC

WM_NCLBUTTONDOWN

0x00A1

 

0x0200

WM_MOUSEFIRST

WM_NCLBUTTONUP

0x00A2

 

0x0200

WM_MOUSEMOVE

WM_NCMBUTTONDBLCLK

0x00A9

 

0x0201

WM_LBUTTONDOWN

WM_NCMBUTTONDOWN

0x00A7

 

0x0202

WM_LBUTTONUP

WM_NCMBUTTONUP

0x00A8

 

0x0203

WM_LBUTTONDBLCLK

WM_NCMOUSEHOVER

0x02A0

 

0x0204

WM_RBUTTONDOWN

WM_NCMOUSELEAVE

0x02A2

 

0x0205

WM_RBUTTONUP

WM_NCMOUSEMOVE

0x00A0

 

0x0206

WM_RBUTTONDBLCLK

WM_NCPAINT

0x0085

 

0x0207

WM_MBUTTONDOWN

WM_NCRBUTTONDBLCLK

0x00A6

 

0x0208

WM_MBUTTONUP

WM_NCRBUTTONDOWN

0x00A4

 

0x0209

WM_MBUTTONDBLCLK

WM_NCRBUTTONUP

0x00A5

 

0x0209

WM_MOUSELAST(95)

WM_NCXBUTTONDBLCLK

0x00AD

 

0x020A

WM_MOUSEWHEEL

WM_NCXBUTTONDOWN

0x00AB

 

0x020A

WM_MOUSELAST(NT4,98)

WM_NCXBUTTONUP

0x00AC

 

0x020B

WM_XBUTTONDOWN

WM_NEXTDLGCTL

0x0028

 

0x020C

WM_XBUTTONUP

WM_NEXTMENU

0x0213

 

0x020D

WM_XBUTTONDBLCLK

WM_NOTIFY

0x004E

 

0x020D

WM_MOUSELAST(2K,XP,2k3)

WM_NOTIFYFORMAT

0x0055

 

0x0210

WM_PARENTNOTIFY

WM_NULL

0x0000

 

0x0211

WM_ENTERMENULOOP

WM_PAINT

0x000F

 

0x0212

WM_EXITMENULOOP

WM_PAINTCLIPBOARD

0x0309

 

0x0213

WM_NEXTMENU

WM_PAINTICON

0x0026

 

0x0214

WM_SIZING

WM_PALETTECHANGED

0x0311

 

0x0215

WM_CAPTURECHANGED

WM_PALETTEISCHANGING

0x0310

 

0x0216

WM_MOVING

WM_PARENTNOTIFY

0x0210

 

0x0218

WM_POWERBROADCAST

WM_PASTE

0x0302

 

0x0219

WM_DEVICECHANGE

WM_PENWINFIRST

0x0380

 

0x0220

WM_MDICREATE

WM_PENWINLAST

0x038F

 

0x0221

WM_MDIDESTROY

WM_POWER

0x0048

 

0x0222

WM_MDIACTIVATE

WM_POWERBROADCAST

0x0218

 

0x0223

WM_MDIRESTORE

WM_PRINT

0x0317

 

0x0224

WM_MDINEXT

WM_PRINTCLIENT

0x0318

 

0x0225

WM_MDIMAXIMIZE

WM_QUERYDRAGICON

0x0037

 

0x0226

WM_MDITILE

WM_QUERYENDSESSION

0x0011

 

0x0227

WM_MDICASCADE

WM_QUERYNEWPALETTE

0x030F

 

0x0228

WM_MDIICONARRANGE

WM_QUERYOPEN

0x0013

 

0x0229

WM_MDIGETACTIVE

WM_QUERYUISTATE

0x0129

 

0x0230

WM_MDISETMENU

WM_QUEUESYNC

0x0023

 

0x0231

WM_ENTERSIZEMOVE

WM_QUIT

0x0012

 

0x0232

WM_EXITSIZEMOVE

WM_RBUTTONDBLCLK

0x0206

 

0x0233

WM_DROPFILES

WM_RBUTTONDOWN

0x0204

 

0x0234

WM_MDIREFRESHMENU

WM_RBUTTONUP

0x0205

 

0x0281

WM_IME_SETCONTEXT

WM_RENDERALLFORMATS

0x0306

 

0x0282

WM_IME_NOTIFY

WM_RENDERFORMAT

0x0305

 

0x0283

WM_IME_CONTROL

WM_SETCURSOR

0x0020

 

0x0284

WM_IME_COMPOSITIONFULL

WM_SETFOCUS

0x0007

 

0x0285

WM_IME_SELECT

WM_SETFONT

0x0030

 

0x0286

WM_IME_CHAR

WM_SETHOTKEY

0x0032

 

0x0288

WM_IME_REQUEST

WM_SETICON

0x0080

 

0x0290

WM_IME_KEYDOWN

WM_SETREDRAW

0x000B

 

0x0291

WM_IME_KEYUP

WM_SETTEXT

0x000C

 

0x02A1

WM_MOUSEHOVER

WM_SETTINGCHANGE

0x001A

 

0x02A3

WM_MOUSELEAVE

WM_SHOWWINDOW

0x0018

 

0x02A0

WM_NCMOUSEHOVER

WM_SIZE

0x0005

 

0x02A2

WM_NCMOUSELEAVE

WM_SIZECLIPBOARD

0x030B

 

0x02B1

WM_WTSSESSION_CHANGE

WM_SIZING

0x0214

 

0x02C0

WM_TABLET_FIRST

WM_SPOOLERSTATUS

0x002A

 

0x02DF

WM_TABLET_LAST

WM_STYLECHANGED

0x007D

 

0x0300

WM_CUT

WM_STYLECHANGING

0x007C

 

0x0301

WM_COPY

WM_SYNCPAINT

0x0088

 

0x0302

WM_PASTE

WM_SYSCHAR

0x0106

 

0x0303

WM_CLEAR

WM_SYSCOLORCHANGE

0x0015

 

0x0304

WM_UNDO

WM_SYSCOMMAND

0x0112

 

0x0305

WM_RENDERFORMAT

WM_SYSDEADCHAR

0x0107

 

0x0306

WM_RENDERALLFORMATS

WM_SYSKEYDOWN

0x0104

 

0x0307

WM_DESTROYCLIPBOARD

WM_SYSKEYUP

0x0105

 

0x0308

WM_DRAWCLIPBOARD

WM_TABLET_FIRST

0x02C0

 

0x0309

WM_PAINTCLIPBOARD

WM_TABLET_LAST

0x02DF

 

0x030A

WM_VSCROLLCLIPBOARD

WM_TCARD

0x0052

 

0x030B

WM_SIZECLIPBOARD

WM_THEMECHANGED

0x031A

 

0x030C

WM_ASKCBFORMATNAME

WM_TIMECHANGE

0x001E

 

0x030D

WM_CHANGECBCHAIN

WM_TIMER

0x0113

 

0x030E

WM_HSCROLLCLIPBOARD

WM_UNDO

0x0304

 

0x030F

WM_QUERYNEWPALETTE

WM_UNICHAR

0x0109

 

0x0310

WM_PALETTEISCHANGING

WM_UNINITMENUPOPUP

0x0125

 

0x0311

WM_PALETTECHANGED

WM_UPDATEUISTATE

0x0128

 

0x0312

WM_HOTKEY

WM_USER

0x0400

 

0x0317

WM_PRINT

WM_USERCHANGED

0x0054

 

0x0318

WM_PRINTCLIENT

WM_VKEYTOITEM

0x002E

 

0x0319

WM_APPCOMMAND

WM_VSCROLL

0x0115

 

0x031A

WM_THEMECHANGED

WM_VSCROLLCLIPBOARD

0x030A

 

0x0358

WM_HANDHELDFIRST

WM_WINDOWPOSCHANGED

0x0047

 

0x035F

WM_HANDHELDLAST

WM_WINDOWPOSCHANGING

0x0046

 

0x0360

WM_AFXFIRST

WM_WININICHANGE

0x001A

 

0x037F

WM_AFXLAST

WM_WTSSESSION_CHANGE

0x02B1

 

0x0380

WM_PENWINFIRST

WM_XBUTTONDBLCLK

0x020D

 

0x038F

WM_PENWINLAST

WM_XBUTTONDOWN

0x020B

 

0x0400

WM_USER

WM_XBUTTONUP

0x020C

 

0x8000

WM_APP

标签:IME,C#,WM,int,WPF,任务栏,public,RECT,left
From: https://www.cnblogs.com/z5337/p/18410728

相关文章

  • 《黑神话:悟空》游戏启动时闪退弹窗“找不到msvcp100.dll”文件该怎么办?黑神话悟空游戏
    在启动《黑神话:悟空》时,若遇到闪退弹窗并提示“找不到msvcp100.dll”文件,别紧张。这可能是文件缺失造成的。您可以使用系统的修复工具尝试解决,或者从可靠来源获取该文件进行安装,有望解决此问题。本篇将为大家带来《黑神话:悟空》游戏启动时闪退弹窗“找不到msvcp100.dll”文件该......
  • MyCat管理及监控
    目录MyCat原理MyCat管理MyCat-web安装Zookeeper安装Mycat-webMyCat原理在MyCat中,当执行一条SQL语句时,MyCat需要进行SQL解析、分片分析、路由分析、读写分离分析等操作,最终经过一系列的分析决定将当前的SQL语句到底路由到那几个(或哪一个)节点数据库,数据库将数据执......
  • bluecms搭建和代码审计(SQL)
    bluecms搭建将bluecms的源码文件bluecms放在www目录下,进入bluecms/install/index.php目录安装bluecms填写数据库配置信息和管理员账号信息填写完上述信息后,会自动在bluecms数据库下创建这些文件返回主界面http://127.0.0.1/bluecms后发现管理员不能从前台登录,需要从http:......
  • Windows软件包管理器安装Chocolatey
    Windows用户建议先安装 Chocolatey,这是一个Windows下的命令行软件管理器,可以方便开发者像在Linux下使用yum命令来安装软件,或者像在macOS下使用brew命令来安装软件,非常酷炫。1、安装Chocolatey使用管理员权限执行powershell,执行Set-ExecutionPolicyBypass-Scope......
  • 2024最详细pycharm安装教程+最新pycharm专业版激活码
    一、Pycharm激活激活码(复制粘贴即可)KQ8KMJ77TY-eyJsaWNlbnNlSWQiOiJLUThLTUo3N1RZIiwibGljZW5zZWVOYW1lIjoiVW5pdmVyc2l0YXMgTmVnZXJpIE1hbGFuZyIsImxpY2Vuc2VlVHlwZSI6IkNMQVNTUk9PTSIsImFzc2lnbmVlTmFtZSI6IkpldOWFqOWutuahtiDorqTlh4blupflkI0iLCJhc3NpZ25lZUVtYWlsIjoibm......
  • 线程---实践与技巧(C语言)
            目录一、引言二、线程基础  1.线程概念  2.线程库三、线程的创建与终止  1.创建线程  2.终止线程四、线程同步与互斥  1.互斥锁(Mutex)  2.条件变量(ConditionVariable)五、线程间的通信六、总结               ......
  • 在shell中使用github copilot
    brewinstallghghauthloginghextensioninstallgithub/gh-copilot   createalias:aliascopilot='ghcopilot';echo'aliascopilot="ghcopilot"'>>~/.zshrc&&source~/.zshrcaliasgcs='ghcopilo......
  • C++面试题整理 1
    1.new和malloc什么区别?new和malloc都用于在堆上分配内存,new是c++中的关键字,分配内存后还会调用构造函数2.std中unorded_map,map,multimap有什么区别?unorderd_map中元素不按键值排序,底层数据结构是哈希表,相对map查询速度快,内存开销大map中元素按键值排序,底层数据结构是红黑......
  • VCSA基于ansible批量创建虚拟机
    基于ansible批量创建虚拟机安装模块pipinstall--upgradeansiblepipinstallPyVmomiansible-galaxycollectioninstallcommunity.vmwareansiblevmware_guest如果需要配置IP和计算机名需要安装VMwaretools----hosts:localhost##在本机执行gather_facts:......
  • SpringCloud入门(二)服务间调用和案例
    一、微服务拆分注意事项微服务拆分注意事项:1.单一职责:不同微服务,不要重复开发相同业务2.数据独立:不要访问其它微服务的数据库3.面向服务:将自己的业务暴露为接口,供其它微服务调用1.微服务需要根据业务模块拆分,做到单一职责,不要重复开发相同业务2.微服务可以将业务暴露为接口,供其......