Esempio n. 1
0
void CTimeMApp::OnFileNew()
{
	if(SaveAllModified())
	{
		CloseAllDocuments(FALSE);
		CWinAppEx::OnFileNew();
	}
}
Esempio n. 2
0
	~CWordHelper()
	{
		if(m_spApplication != 0)
		{
			CloseAllDocuments();
			_variant_t vtFalse = false;
			m_spApplication->Quit(&vtFalse,&vtFalse,&vtFalse);
			m_spApplication.Release();
			m_spApplication = NULL;
		}
		::CoUninitialize();
	}
Esempio n. 3
0
CDocument* CTimeMApp::OpenDocumentFile(LPCTSTR lpszFileName)
{
	if(IsFileVideo(lpszFileName))
	{
		CMainFrame* pMain = (CMainFrame*)AfxGetMainWnd();
		if((NULL != pMain)
			&&(pMain->IsKindOf(RUNTIME_CLASS(CMainFrame))))
		{
			CPropertiesWnd* pVideo = pMain->GetPropertyWnd();
			if(NULL != pVideo)
				pVideo->VideoFileOpen(lpszFileName);
		}
		return NULL;
	}

	if(SaveAllModified())
	{
		CloseAllDocuments(FALSE);
		return CWinAppEx::OpenDocumentFile(lpszFileName);
	}
	return NULL;
}
CDocument* CWinHTTrackApp::OpenDocumentFile( LPCTSTR lpszFileName)
{
  // Eviter deux fenêtres (un seul document)
  // Le CMultui..->CSingleDoc.. est trop complexe à changer (à cause du splitter-wnd)
  int count=1;

  { /* Check if a document exists, and if exists if empty or not, and if name is different */
    POSITION pos;
    pos=GetFirstDocTemplatePosition();
    if (pos) {
      CDocTemplate* tmpl=GetNextDocTemplate(pos);
      if (tmpl) {
        pos=tmpl->GetFirstDocPosition();
        if (pos) {
          CDocument* doc  = tmpl->GetNextDoc(pos);
          if (doc) {
            if (dialog0->GetName().GetLength()==0) {
              CloseAllDocuments(FALSE);
              count=0;        /* No documents */
            } else {
              if (dialog0->GetPath0()+".whtt" == LPCSTR(lpszFileName))
                return NULL;
            }
          }
        } else
          count=0;          /* No documents */
      }
    }
  }

  // Ouvrir nouvelle instance
  if (count) {
    char cmdl[2048];
    TCHAR ModulePath[MAX_PATH + 1];
    ModulePath[0] = '\0';
    ::GetModuleFileName(NULL, ModulePath, sizeof(ModulePath)/sizeof(TCHAR) - 1);
    CString name = ModulePath;
    strcpybuff(cmdl,"\"");
    strcatbuff(cmdl,lpszFileName);
    strcatbuff(cmdl,"\"");
    ShellExecute(NULL,"open",name,cmdl,"",SW_RESTORE);
    return NULL;
  }

  // Ouvrir nouveau?
  //if (count)
  //  return;       // ne rien faire, car limité à 1 document
  //count++;

  /* Ouvrir */
  /*
  CWinApp* app=AfxGetApp();
  POSITION pos;
  pos=app->GetFirstDocTemplatePosition();
  CDocTemplate* templ = app->GetNextDocTemplate(pos);
  pos=templ->GetFirstDocPosition();
  if (pos) {
    CDocument* doc  = templ->GetNextDoc(pos);
    if (doc)
      if (!doc->SaveModified())
        return NULL;
  }
  CloseAllDocuments(FALSE);
  */
  if (strlen(lpszFileName))
    return CWinApp::OpenDocumentFile(lpszFileName);
  else
    CWinApp::OnFileNew();
  return NULL;
}