重载消息:WM_GETMINMAXINFO。
1. 消息:ON_WM_GETMINMAXINFO
BEGIN_MESSAGE_MAP(COfflineSCDlg, CDialog)
//{{AFX_MSG_MAP(COfflineSCDlg)
ON_WM_GETMINMAXINFO()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
2. 类定义:afx_msg void OnGetMinMaxInfo( MINMAXINFO FAR* lpMMI );
public:
// Dialog Data
//{{AFX_DATA(COfflineSCDlg)
enum { IDD = IDD_AAA_DIALOG };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(COfflineSCDlg)
public:
virtual BOOL DestroyWindow();
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
virtual void OnSize(UINT nType, int cx, int cy);
afx_msg void OnGetMinMaxInfo( MINMAXINFO FAR* lpMMI );
//}}AFX_VIRTUAL
3. 实现:OnGetMinMaxInfo
// 限制窗口的大小
void CAAADlg::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI)
{
lpMMI->ptMinTrackSize.x=400; //限定最小宽度
lpMMI->ptMinTrackSize.y=400; //限定最小高度
// lpMMI->ptMaxTrackSize.x=100; //限定最大宽度
// lpMMI->ptMaxTrackSize.y=100; //限定最大高度
CDialog::OnGetMinMaxInfo(lpMMI);
}