Re: modeless child dialog notifying parent
Actually, my method of using OnActvate works...
void CDataGrapherDlg::OnActivate(UINT nState, CWnd* pWndOther, BOOL
bMinimized)
{
CDialog::OnActivate(nState, pWndOther, bMinimized);
if(m_TrigDlg && m_DataSrcDlg)
if(nState == WA_ACTIVE && pWndOther == m_TrigDlg &&
!m_TrigDlg->IsWindowVisible())
//reset button
else if(nState == WA_ACTIVE && pWndOther == (CWnd*)m_DataSrcDlg &&
!m_DataSrcDlg->IsWindowVisible())
//reset button
}
can anybody confirm that the parent window always gets focus after a child
dialog closes?
Nick
"Scott McPhillips [MVP]" <org-dot-mvps-at-scottmcp> wrote in message
news:e9Z3mPn$IHA.2244@TK2MSFTNGP05.phx.gbl...
"Nick Schultz" <nick.schultz@flir.com> wrote in message
news:evM522m$IHA.3380@TK2MSFTNGP04.phx.gbl...
How do you get the child modeless dialog to notify the parent that the
user closed the window?
I have a push button that is depressed when the window is visible, and
normal when the window is invisible. I need to know if the user closed
the window so I can reset the push button.
Running spy++ shows that there isn't a message being sent that....
Your child window can send its own custom message.
// child.h
#define UWM_CHILD_CLOSED
// child.cpp, in OnClose or similar
GetParent()->SendMessage(UWM_CHILD_CLOSED, 0, 0);
//The parent would use this in its message map:
ON_MESSAGE(UWM_CHILD_CLOSED, OnChildClosed)
// and the message handler function must have this signature:
LRESULT CTheParentWnd::OnChildClosed(WPARAM w, LPARAM l)
{ ...
return 0;
}
--
Scott McPhillips [VC++ MVP]