这是我搜到的比较好的解决方案了,调试然后修改了nDoFirstHide = 4 ,使得正好隐藏了,代码如下:
class CxxDlg : public CDialog { protected: int nDoFirstHide;//设置第一启动就隐藏的次数 }
CxxDlg::CxxDlg(CWnd* pParent /*=NULL*/) : CDialog(CxxDlg::IDD, pParent) { nDoFirstHide = 4; }
BEGIN_MESSAGE_MAP(CxxDlg, CDialog) ON_WM_WINDOWPOSCHANGING() END_MESSAGE_MAP()
void CxxDlg::OnWindowPosChanging(WINDOWPOS* lpwndpos) { if(nDoFirstHide -- < 1)//开始运行才隐藏,以后有SW_SHOW就正常显示 { CDialog::OnWindowPosChanging(lpwndpos); return; } //启动隐藏 if(lpwndpos->flags&SWP_SHOWWINDOW) { lpwndpos->flags&=~SWP_SHOWWINDOW; PostMessage(WM_WINDOWPOSCHANGING,0,(LPARAM)lpwndpos); ShowWindow(SW_HIDE); } else CDialog::OnWindowPosChanging(lpwndpos); }
|
阅读(1239) | 评论(0) | 转发(0) |