|
本帖最后由 ghosthand 于 2014-2-25 00:11 编辑
1、声明窗体回调函数,在对话框的头文件中- // Generated message map functions
- //{{AFX_MSG(CHappyDlg)
- afx_msg void OnWindowPosChanging(WINDOWPOS* lpwndpos);
- //}}AFX_MSG
- DECLARE_MESSAGE_MAP()
复制代码 2、在窗体实现文件中作消息映射- BEGIN_MESSAGE_MAP(CHappyDlg, CDialog)
- //{{AFX_MSG_MAP(CHappyDlg)
- ON_WM_WINDOWPOSCHANGING()
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
复制代码 3、在消息处理中对窗体实现隐藏- void CXXXDlg::OnWindowPosChanging(WINDOWPOS* lpwndpos)
- {
- //启动隐藏
- if(lpwndpos->flags&SWP_SHOWWINDOW)
- {
- lpwndpos->flags&=~SWP_SHOWWINDOW;
- PostMessage(WM_WINDOWPOSCHANGING,0,(LPARAM)lpwndpos);
- ShowWindow(SW_HIDE);
- }
- else
- CDialog::OnWindowPosChanging(lpwndpos);
- }
复制代码 |
|