Thanks in advance,
SaranG.
Hi SaranG,
nomally I use for multiple dialoges the classes CPropertySheet /
CPropertyPage. I don't know if you do so. But I will explain you the way to
close the pages on the following sample.
CPropertySheet = parent
|
+-> CPropertyPage -> CPropertySheet = parent
| : |
+-> CPropertyPage .. +-> CPropertyPage ..
| : | :
+-> CPropertyPage .. +-> CPropertyPage ..
| : | :
/*==================================================
OnOK ( CPropertyPage )
==================================================*/
void CppXXXX::OnOK()
{
CPropertyPage::OnOK();
// On button OK send a close message to the parent
// ( CPropertySheet ) and let him close the childs
CWnd* pParentWnd = GetParent();
pParentWnd->SendMessage( WM_CLOSE, 0, (LPARAM)0 );
}
/*==================================================
OnOK ( CPropertySheet )
==================================================*/
void CpshXXXX::OnClose()
{
WORD i;
if( pDaten->m_pPropPages[i]->m_hWnd != NULL )
{ // send a close message to the child ( CPropertyPage )
for( i = 0; i < 3; i++ )
{ CWnd* pChildWnd = FromHandle( pDaten->m_pPropPages[i]->m_hWnd );
pChildWnd->SendMessage( WM_CLOSE, 0, (LPARAM)0 ); }
}
CPropertySheet::OnClose();
}
Continue this way until all your dialogues are closed. Also implement the
close for the cancel button.
Maybe it will help you.
Regards
werner m...
Sorry, in my previously sent reply was something missing !
/*===================================================
OnClose ( CPropertySheet )
=====================================================*/
void CpshXXXX::OnClose()
{
WORD i;
if( strcmp(m_pClassParent->m_lpszClassName, "CppXXXXUeR" ) == 0 )
{ // CPropertyPage parent
CppXXXXUeR* pDaten = (CppXXXXUeR*) m_pParent;
if( pDaten->m_pPropPages[i]->m_hWnd != NULL )
{ // send a close message to the child ( CPropertyPage )
for( i = 0; i < 3; i++ )
{ CWnd* pChildWnd = FromHandle( pDaten->m_pPropPages[i]->m_hWnd );
pChildWnd->SendMessage( WM_CLOSE, 0, (LPARAM)0 ); }
}
}
else
{ if( strcmp(m_pClassParent->m_lpszClassName, "CppXXXXStR" ) == 0 )
{ // Another CPropertyPage parent
CppXXXXStR* pDaten = (CppXXXXStR*) m_pParent;
for( i = 0; i < 3; i++ )
{ if( pDaten->m_pPropPages[i] != NULL )
{ if( pDaten->m_pPropPages[i]->m_hWnd != NULL )
{ // send a close message to the child ( CPropertyPage )
CWnd* pChildWnd = FromHandle(
pDaten->m_pPropPages[i]->m_hWnd );
pChildWnd->SendMessage( WM_CLOSE, 0, (LPARAM)0 ); }
}
}
}
}
CPropertySheet::OnClose();
}
Regards
werner m...
http://msdn.microsoft.com/en-us/library/ms633494(VS.85).aspx
To call a function for all open windows and just send the message to the
dialog types (or whatever types you want to close).
Tom
"SaranG(Saravanan)" <infos...@gmail.com> wrote in message
news:340ee8dd-73fe-4a2c...@25g2000hsx.googlegroups.com...
For modal it is trivial. You click the "Close All" button on the most recent modal dialog
and then you explicitly call EndDialog with a code that is not expected (e.g., IDABORT),
and the caller interprets that to be a request to close itself with the same code, etc.
For modeless, I tend to do something like SendMessageToDescendants from the mainframe with
a user-defined message such as UWM_CLOSE_ALL_DIALOGS and every modeless dialog that
receives it closes itself.
joe
On Tue, 22 Jul 2008 04:10:46 -0700 (PDT), "SaranG(Saravanan)" <infos...@gmail.com>
wrote:
Joseph M. Newcomer [MVP]
email: newc...@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
Hi,
Thanks for all who enlighten me up. And i made that closing of
all open dialog with some flag variables usage.
And tried with the WM_CLOSE message.
Once again,
Thanks
SaranG.