IComparison* Comparisons::Open(LPCTSTR wdfDocId) { AFX_MANAGE_STATE(AfxGetAppModuleState()); AutomationInteractionSuppressor ais; CMDIFrameWnd* pMainFrame = DYNAMIC_DOWNCAST(CMDIFrameWnd, AfxGetMainWnd()); GetApp()->RealFileNew(); // TODO - can we get the frame in a better way CChildFrame *pFrame = DYNAMIC_DOWNCAST( CChildFrame, pMainFrame->MDIGetActive() ); if (pFrame) { // TODO - do we need this GetDVController(pFrame)->CloseDocument(true); GetDVController(pFrame)->CloseDocument(false); GetDVController(pFrame)->CloseCompositeDocument(); GetDVController(pFrame)->GetComparisonDocController().CloseComparisonDocument(); if( pFrame->GetCompositeBar() ) pFrame->GetCompositeBar()->OnInitialUpdate(); pFrame->ShowWindow(SW_SHOW); pFrame->BringWindowToTop(); if (!GetDVController(pFrame)->LoadWDF(wdfDocId)) { AfxThrowOleDispatchException(1102, L"File not found : " + CString(wdfDocId)); } pFrame->GetDocument()->UpdateAllViews(NULL); UpdateOpenList(); return FindComObject(pFrame->GetDocument()); } AfxThrowOleDispatchException(1101, L"Internal Error"); return NULL; }