G
Guest
I have the MDI MFC application ported to .NET.
Now this application include mixed managed/unmanaged code.
The application displays progress dialog with the cancel button
during lenghtly operation. This progress dialog implemented as
modeless to allow user to cancel the lenghtly operation if he
wishes. At the same time I disable mainframe window to prevent
user from clicking on the menu bar.
Here is the segment of the code:
void CCommProgressDialog::Show(CWnd* pParent/*=NULL*/ )
{
if(!::IsWindow(m_hWnd) )
{
if(Create(IDD, pParent ) )
{
m_pParentWnd = pParent ; // Create not set it (MFC Bug ??)
SetText("" ) ;
SetProgressText("" ) ;
CenterWindow();
ShowWindow(SW_SHOW ) ;
UpdateWindow() ;
SetFocus() ;
if(pParent )
{
pParent->EnableWindow(FALSE ) ;
}
}
}
}
I notice recently that cancel button on that dialog doesn't work.
In fact the dialog is simply disable, you can't even move it.
I isolated the problem to the following code
if(pParent )
{
pParent->EnableWindow(FALSE ) ;
}
Can anyone explain, why disabling the parent window also disabling
the child modeless dialog? Has anyone experienced such problem?
Thanks
Now this application include mixed managed/unmanaged code.
The application displays progress dialog with the cancel button
during lenghtly operation. This progress dialog implemented as
modeless to allow user to cancel the lenghtly operation if he
wishes. At the same time I disable mainframe window to prevent
user from clicking on the menu bar.
Here is the segment of the code:
void CCommProgressDialog::Show(CWnd* pParent/*=NULL*/ )
{
if(!::IsWindow(m_hWnd) )
{
if(Create(IDD, pParent ) )
{
m_pParentWnd = pParent ; // Create not set it (MFC Bug ??)
SetText("" ) ;
SetProgressText("" ) ;
CenterWindow();
ShowWindow(SW_SHOW ) ;
UpdateWindow() ;
SetFocus() ;
if(pParent )
{
pParent->EnableWindow(FALSE ) ;
}
}
}
}
I notice recently that cancel button on that dialog doesn't work.
In fact the dialog is simply disable, you can't even move it.
I isolated the problem to the following code
if(pParent )
{
pParent->EnableWindow(FALSE ) ;
}
Can anyone explain, why disabling the parent window also disabling
the child modeless dialog? Has anyone experienced such problem?
Thanks