visual-c++mfc-feature-packmdichildactive-window

C++, MFC Feature Pack,Mdi childs visibility


I have an MDI MFC FEATURE PACK app in vs2008.

I do need to determine what child window(s) are visible , even if multiple tab groups are created by the user, and also what is the last activated MDI child. I have found that in my mainframe CMDIFrameWndEx class, the methods

m_wndClientArea.FindActiveTabWnd ();
m_wndClientArea.GetFirstTabWnd ();
m_wndClientArea.GetNextTabWnd (); 

that could potentially let me navigate through all tab grops. Trouble is that these methods return an CMFCTabControl that does not offer any method/member to obtain an pointer to the MDI child windows in the tab. It only gives the index of the active tab. So how do I get the CMDIChildWndEx* pointer of the "in front" window of the given tabgroup?


Solution

  • Because your CMDIChildWndEx instances are wrapped in a tab control wrapper you can get the active tab and then the wnd from that, e.g.

    int nActive = pTabCtrl->GetActiveTab();
    CWnd * pWnd = pTabCtrl->GetTabWndNoWrapper( nActive );
    
    CMDIChildWndEx * pChild = dynamic_cast<CMDIChildWndEx*>(pWnd);