Window Maximize/Minimize/Restore 的 WM Windows 消息是什么?

What is the WM Windows message for Window Maximize/Minimize/Restore?

我知道 WM_SIZEWM_SIZING,但是当用户使用系统菜单最大化或最小化 window 时是否会发送消息?

我需要在我的项目中捕获此事件,但我无法 google 了解消息内容。

WM_SIZE 描述:window 大小改变后发送。 wParam 包含原因:

SIZE_MAXIMIZED The window has been maximized. SIZE_MINIMIZED The window has been minimized. SIZE_RESTORED The window has been resized, but neither the SIZE_MINIMIZED nor SIZE_MAXIMIZED value applies.

简而言之,无论什么原因导致调整大小,都会发送 WM_SIZE。单击最大化按钮等于从系统菜单中选择最大化选项。

如果你出于某种原因想要区分鼠标点击和菜单选择,你可以使用WM_NCMOUSEMOVE来检测鼠标移动到右上角。

WM_SYSCOMMAND

A window receives this message when the user chooses a command from the Window menu (formerly known as the system or control menu) or when the user chooses the maximize button, minimize button, restore button, or close button.

wParam 将设置为 SC_MINIMIZESC_MAXIMIZE