Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

Any1 know how to detect document/view change in MDI application. I have MDI app that have several diff types of document/views, each with diff view capabilities. I need to detect when view changes (user select another via MDI view tab ctrl) so I can send appropriate commands to separate devices attached (some for deactivated view, another for activated view).

Thanks
Sasa
Posted
Comments
Sergey Alexandrovich Kryukov 6-Feb-12 10:52am    
Who needs MDI, ever?
--SA

Hi,

one solution I found and using is overriding OnMDIActivate of ChildFrame...


void CChildFrame::OnMDIActivate(BOOL bActivate, CWnd* pActivateWnd, CWnd* pDeactivateWnd)
{
CMDIChildWndEx::OnMDIActivate(bActivate, pActivateWnd, pDeactivateWnd);

CWnd* pWnd = GetDlgItem(AFX_IDW_PANE_FIRST);
if( pWnd->IsKindOf( RUNTIME_CLASS(CNeedeViewType) ) )
{
if( !bActivate )
{
// Do something
}
else
{
// do something
}
}
}


If you know for better/nicer, please advice...
 
Share this answer
 
Hi,

one solution I found and using is overriding OnMDIActivate of ChildFrame...


void CChildFrame::OnMDIActivate(BOOL bActivate, CWnd* pActivateWnd, CWnd* pDeactivateWnd)
{
CMDIChildWndEx::OnMDIActivate(bActivate, pActivateWnd, pDeactivateWnd);

CWnd* pWnd = GetDlgItem(AFX_IDW_PANE_FIRST);
if( pWnd->IsKindOf( RUNTIME_CLASS(CNeedeViewType) ) )
{
if( !bActivate )
{
// Do something
}
else
{
// do something
}
}
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900