思路,在模态对话框最小化时,激活主窗口,同时启用一个定时器,在定时器中判断 到主窗口变化大小时(从最小化到其他状态),把主窗口禁止,代码如下:
void CXXDlg::OnBtnMini() { AfxGetMainWnd()->EnableWindow(TRUE); AfxGetMainWnd()->ShowWindow(SW_MINIMIZE) ; if (m_Timer == 0) m_Timer = SetTimer(SLIDER_TIMER,100,NULL) ; }
void CXXDlg::OnTimer(UINT_PTR nIDEvent) { if (nIDEvent == m_Timer) { CRect rc ; AfxGetMainWnd()->GetClientRect(&rc) ; if (rc.Width()>0) { AfxGetMainWnd()->EnableWindow(false) ; EnableWindow(true) ; KillTimer(m_Timer) ; m_Timer = 0 ; } } CDlg::OnTimer(nIDEvent); }
posted on 2011-06-30 16:25 hgy413 阅读(332) 评论(0) 编辑 收藏 举报
Powered by: 博客园 Copyright © 2024 hgy413 Powered by .NET 9.0 on Kubernetes