Hi,
i want a usally frame window in an mfc application behave like a modal dialog window. I have tried SetModalState(), but it is not working. What can i do?
Thank you in advance!
Bjoern
Printable View
Hi,
i want a usally frame window in an mfc application behave like a modal dialog window. I have tried SetModalState(), but it is not working. What can i do?
Thank you in advance!
Bjoern
Hi man,
You know, you can't make child window modal, because the technique of MODAL windows is disabling parent window until modal window appears....
so according to this do following:
if ( <condition when should appear modal frame window > )
{
//
CWinApp* pApp = AfxGetApp();
if (pApp != NULL)
pApp->EnableModeless(FALSE);
if (m_hWnd != NULL && ::IsWindowEnabled(m_hWnd))
::EnableWindow(m_hWnd, FALSE); // here we go ... KILL PARENT :)
CYourFrameWnd * pFrame = new CYourFrameWnd;
// CYourFrameWnd should be derived from CFrameWnd or CWnd
pFrame -> Create(NULL,"Opps, I gues so I'm modal :)");
pFrame -> RunModalLoop(MLF_SHOWONIDLE); // This is a very Imp.
// you should overide virtual BOOL ContinueModal() function to determine when to call EndModalLoop(int nResult) function to enable parent
}