用Class Wizard重载CYourDlg的WindowProc函数:LRESULT CYourDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) { // TODO: Add your specialized code here and/or call the base class if(message == WM_SYSCOMMAND) { if(wParam == SC_MINIMIZE) AfxMessageBox("SC_MINIMIZE"); else if(wParam == SC_RESTORE) AfxMessageBox("SC_RESTORE"); } return CYourDlg::WindowProc(message, wParam, lParam); }
WM_SIZE The WM_SIZE message is sent to a window after its size has changed. A window receives this message through its WindowProc function. LRESULT CALLBACK WindowProc( HWND hwnd, // handle to window UINT uMsg, // WM_SIZE WPARAM wParam, // resizing flag LPARAM lParam // client area ); Parameters wParam Specifies the type of resizing requested. This parameter can be one of the following values. Value Meaning 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.
{
// TODO: Add your specialized code here and/or call the base class
if(message == WM_SYSCOMMAND)
{
if(wParam == SC_MINIMIZE)
AfxMessageBox("SC_MINIMIZE");
else if(wParam == SC_RESTORE)
AfxMessageBox("SC_RESTORE");
} return CYourDlg::WindowProc(message, wParam, lParam);
}
The WM_SIZE message is sent to a window after its size has changed. A window receives this message through its WindowProc function. LRESULT CALLBACK WindowProc(
HWND hwnd, // handle to window
UINT uMsg, // WM_SIZE
WPARAM wParam, // resizing flag
LPARAM lParam // client area
);
Parameters
wParam
Specifies the type of resizing requested. This parameter can be one of the following values. Value Meaning
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.