如何判断对话框已经初始化

一种笨方法: 加个变量控制

 

另外的方法: 根据已有变量控制

 

若初始化中有创建非模态对话框

 

可以通过,判断非模态对话框句柄是否存在来判断,如下:

 

//初始化中

	m_showImageDlg.Create(IDD_DIALOG_SHOW,this);
	m_showImageDlg.ShowWindow(SW_HIDE);


 

//OnSize中

	if (m_showImageDlg.m_hWnd!=NULL)
	{

		CPathTree * pPathTree=(CPathTree* )(((CMainFrame *)AfxGetMainWnd())->m_wndSplitter.GetPane(0,0));
		if (pPathTree!=NULL)
		{
			CRect rc;
			pPathTree->GetClientRect(&rc);
			pPathTree->ClientToScreen(&rc);
			m_showImageDlg.MoveWindow(rc.TopLeft().x,rc.TopLeft().y,rc.Width(),rc.Height());
		}
	}


 

你可能感兴趣的:(null,dialog)