Dear All,
I am getting assertion error, on implementing the updates for "Close All Others" in MFC Application,, wherein, Tab Document Interface(TDI) has numerous tabs, similar to VS 2008 IDE, and when user right clicks the context menu <<Close All Other>> , which has the following handler ,
The following code will close all except the active tab in the "first" MDI client tab group..
Begin_message_map
..............
ON_COMMAND(ID_TAB_CLOSEOTHER, &CMainFrame::OnTabCloseOther)
............
CMainFrame::OnCloseOtherTab()
{
Line 1. const CObList* tabList = &m_wndClientArea.GetMDITabGroups();
Line 2: CMFCTabCtrl* pTabWnd = (CMFCTabCtrl*)tabList->GetHead();
Line 3. if (pTabWnd != NULL)
Line 4: {
Line 5: int iActiveTab = pTabWnd->GetActiveTab();
Line 6: ASSERT_VALID(pTabWnd);
Line 7: for (int i = pTabWnd->GetTabsNum() - 1; i >= 0; i--)
Line 8: {
Line 9: CMDIChildWndEx* pNextWnd = DYNAMIC_DOWNCAST CMDIChildWndEx........................ }
CMDIChientAreaWnd m_wndClientArea;
The assertion is displayed on execution of Line 2. The following line gets displayed on assertion
return AfxWinMain(hInstance, hPrevInstance, lpCmdLine,nCmdShow);
<<<<Unhandled exception at 0x787d01ec (mfc90d.dll)
in CART.exe: 0xC0000005: Access violation reading location x00000008.>>>>
Please let me know how to correct the above solution.
With Regards,