引自msdn:CWnd::OnActivate afx_msg void OnActivate( UINT nState, CWnd* pWndOther, BOOL bMinimized );ParametersnStateSpecifies whether the CWnd is being activated or deactivated. It can be one of the following values: WA_INACTIVE The window is being deactivated. WA_ACTIVE The window is being activated through some method other than a mouse click (for example, by use of the keyboard interface to select the window). WA_CLICKACTIVE The window is being activated by a mouse click. pWndOtherPointer to the CWnd being activated or deactivated. The pointer can be NULL, and it may be temporary.bMinimizedSpecifies the minimized state of the CWnd being activated or deactivated. A value of TRUE indicates the window is minimized. If TRUE, the CWnd is being activated; otherwise deactivated.
若是简单的最小最大化,是WM_SYSCOMMAND消息
void CXXXDlg::OnSize(UINT nType, int cx, int cy)
{
CDialog::OnSize(nType, cx, cy);
// TODO: Add your message handler code here
if(nType == SIZE_MINIMIZED) AfxMessageBox("SIZE_MINIMIZED");
}
映射此消息,如果消息的wParam为WA_ACTIVE则表示程序被激活。
afx_msg void OnActivate( UINT nState, CWnd* pWndOther, BOOL bMinimized );ParametersnStateSpecifies whether the CWnd is being activated or deactivated. It can be one of the following values: WA_INACTIVE The window is being deactivated.
WA_ACTIVE The window is being activated through some method other than a mouse click (for example, by use of the keyboard interface to select the window).
WA_CLICKACTIVE The window is being activated by a mouse click.
pWndOtherPointer to the CWnd being activated or deactivated. The pointer can be NULL, and it may be temporary.bMinimizedSpecifies the minimized state of the CWnd being activated or deactivated. A value of TRUE indicates the window is minimized. If TRUE, the CWnd is being activated; otherwise deactivated.