Ejemplo n.º 1
0
BOOL CGlobalObj::bOpenFunctioneditorfile(CString omStrNewCFileName)
{
    BOOL bFileFound = TRUE;

    CFunctionEditorDoc* pDoc = CFunctionEditorBase::pCreateNewDocument(m_eBus);
    // file-attribute information
    if (pDoc != nullptr)
    {
        CEditFrameWnd::sm_eBus = m_eBus;
        struct _tfinddata_t fileinfo;
        // Check if file exists
        if (_tfindfirst( omStrNewCFileName.GetBuffer(MAX_PATH), &fileinfo) == -1L)
        {
            bFileFound = pDoc->bCreateNewDocument(omStrNewCFileName);
        }
        if (bFileFound == TRUE)
        {
            //// Now open the selected file
            pDoc->OnOpenDocument(omStrNewCFileName);
            CMultiDocTemplate* pTemplate = m_pEditorDocTemplate;
            m_pEditFrameWnd = (CEditFrameWnd*)(pTemplate->CreateNewFrame(pDoc, nullptr));

            //If null is passed as parameter the m_pdoc->GetNextView(pos)  will
            // give null value
            if (m_pEditFrameWnd != nullptr)
            {
                ASSERT_KINDOF(CEditFrameWnd, m_pEditFrameWnd);
                pTemplate->InitialUpdateFrame(m_pEditFrameWnd, /*nullptr*/pDoc);
            }
        }
    }
    return bFileFound;
}
void CMDIHelloDoc::OnViewDataform() 
{
	// TODO: Add your command handler code here
	if(m_pDataForm) {
		m_pDataForm->MDIActivate();
		if(m_pDataForm->IsIconic())
			m_pDataForm->ShowWindow(SW_RESTORE);
	}
	else {
		CMDIHelloApp* pApp = (CMDIHelloApp*)AfxGetApp();
		CMultiDocTemplate* pTemplate = pApp->GetFormTemplate();
		m_pDataForm = (CMDIChildWnd*)pTemplate->CreateNewFrame(this, NULL);
		pTemplate->InitialUpdateFrame(m_pDataForm, this);
	}
}