The WM_SIZE message is sent to a window after its size has changed.A window receives this message through its WindowProc function. SyntaxWM_SIZE WPARAM wParam LPARAM lParam;
ParameterswParam Specifies the type of resizing requested. This parameter can be one of the following values. SIZE_MAXHIDE Message is sent to all pop-up windows when some other window is maximized. SIZE_MAXIMIZED The window has been maximized. SIZE_MAXSHOW Message is sent to all pop-up windows when some other window has been restored to its former size. SIZE_MINIMIZED The window has been minimized. SIZE_RESTORED The window has been resized, but neither the SIZE_MINIMIZED nor SIZE_MAXIMIZED value applies. lParam The low-order word of lParam specifies the new width of the client area. The high-order word of lParam specifies the new height of the client area.
CWnd::OnSizeThe framework calls this member function after the window's size has changed.afx_msg void OnSize( UINT nType, int cx, int cy ); Parameters nType Specifies the type of resizing requested. This parameter can be one of the following values: SIZE_MAXIMIZED Window has been maximized. SIZE_MINIMIZED Window has been minimized. SIZE_RESTORED Window has been resized, but neither SIZE_MINIMIZED nor SIZE_MAXIMIZED applies. SIZE_MAXHIDE Message is sent to all pop-up windows when some other window is maximized. SIZE_MAXSHOW Message is sent to all pop-up windows when some other window has been restored to its former size. cx Specifies the new width of the client area. cy Specifies the new height of the client area.
GetWindowPlacement函数似乎可以检测到窗口状态 来自MSDN的解释: The GetWindowPlacement function retrieves the show state and the restored, minimized, and maximized positions of the specified window.
SyntaxWM_SIZE WPARAM wParam
LPARAM lParam;
ParameterswParam
Specifies the type of resizing requested. This parameter can be one of the following values.
SIZE_MAXHIDE
Message is sent to all pop-up windows when some other window is maximized.
SIZE_MAXIMIZED
The window has been maximized.
SIZE_MAXSHOW
Message is sent to all pop-up windows when some other window has been restored to its former size.
SIZE_MINIMIZED
The window has been minimized.
SIZE_RESTORED
The window has been resized, but neither the SIZE_MINIMIZED nor SIZE_MAXIMIZED value applies.
lParam
The low-order word of lParam specifies the new width of the client area.
The high-order word of lParam specifies the new height of the client area.
UINT nType,
int cx,
int cy
);
Parameters
nType
Specifies the type of resizing requested. This parameter can be one of the following values:
SIZE_MAXIMIZED Window has been maximized.
SIZE_MINIMIZED Window has been minimized.
SIZE_RESTORED Window has been resized, but neither SIZE_MINIMIZED nor SIZE_MAXIMIZED applies.
SIZE_MAXHIDE Message is sent to all pop-up windows when some other window is maximized.
SIZE_MAXSHOW Message is sent to all pop-up windows when some other window has been restored to its former size.
cx
Specifies the new width of the client area.
cy
Specifies the new height of the client area.
CWindow myWindow;
myWindow.Attach(hWnd);
BOOL bIconic = myWindow.IsIconic();~~~~~~~~~~~~~~~~~~~~~
IsZoomed()//判断窗口是否最大化
来自MSDN的解释:
The GetWindowPlacement function retrieves the show state and the restored, minimized, and maximized positions of the specified window.