DocMgrEx.cpp
//////////////////
// This function is copied from MFC's docmgr.cpp, w/one minor
// modifcation to use CFileDialogEx. 
//

This function is copied from MFC's docmgr.cpp, w/one minor
modifcation to use CFileDialogEx.
This function is copied from MFC ' s docmgr . cpp w / one minor modifcation to use CFileDialogEx .
BOOL CDocManagerEx::DoPromptFileName(CString& fileName, UINT nIDSTitle,
   DWORD lFlags, BOOL bOpenFileDialog, CDocTemplate* pTemplate)
{
   CFileDialog* pDlg = OnCreateFileDialog(bOpenFileDialog);
   ASSERT(pDlg);
   CFileDialog& dlgFile = *pDlg;
   CString title;
   VERIFY(title.LoadString(nIDSTitle));
   dlgFile.m_ofn.Flags |= lFlags;
   CString strFilter;
   CString strDefault;
   if (pTemplate != NULL)
   {
      ASSERT_VALID(pTemplate);
      _AfxAppendFilterSuffix(strFilter, dlgFile.m_ofn, pTemplate, &strDefault);
   }
   else
   {
      POSITION pos = m_templateList.GetHeadPosition();
      BOOL bFirst = TRUE;
      while (pos != NULL)
      {
         CDocTemplate* pTemplate = (CDocTemplate*)m_templateList.GetNext(pos);
         _AfxAppendFilterSuffix(strFilter, dlgFile.m_ofn, pTemplate,
            bFirst ? &strDefault : NULL);
         bFirst = FALSE;
      }
   }
   CString allFilter;
   VERIFY(allFilter.LoadString(AFX_IDS_ALLFILTER));
   strFilter += allFilter;
   strFilter += (TCHAR)'\0';   
   strFilter += _T("*.*");
   strFilter += (TCHAR)'\0';   
   dlgFile.m_ofn.nMaxCustFilter++;
   dlgFile.m_ofn.lpstrFilter = strFilter;
   dlgFile.m_ofn.lpstrTitle = title;
   dlgFile.m_ofn.lpstrFile = fileName.GetBuffer(_MAX_PATH);
   int nResult = dlgFile.DoModal();
   fileName.ReleaseBuffer();
   delete pDlg;
   return nResult == IDOK;
}
BOOL CDocManagerEx :: DoPromptFileName ( CString & fileName , UINT nIDSTitle , DWORD lFlags , BOOL bOpenFileDialog , CDocTemplate * pTemplate ) { CFileDialog * pDlg = OnCreateFileDialog ( bOpenFileDialog ) ; ASSERT ( pDlg ) ; CFileDialog & dlgFile = * pDlg ; CString title ; VERIFY ( title . LoadString ( nIDSTitle ) ) ; dlgFile . m_ofn . Flags |= lFlags ; CString strFilter ; CString strDefault ; if ( pTemplate != NULL ) { ASSERT_VALID ( pTemplate ) ; _AfxAppendFilterSuffix ( strFilter , dlgFile . m_ofn , pTemplate , & strDefault ) ; } else { POSITION pos = m_templateList . GetHeadPosition ( ) ; BOOL bFirst = TRUE ; while ( pos != NULL ) { CDocTemplate * pTemplate = ( CDocTemplate * ) m_templateList . GetNext ( pos ) ; _AfxAppendFilterSuffix ( strFilter , dlgFile . m_ofn , pTemplate , bFirst ? & strDefault : NULL ) ; bFirst = FALSE ; } } CString allFilter ; VERIFY ( allFilter . LoadString ( AFX_IDS_ALLFILTER ) ) ; strFilter += allFilter ; strFilter += ( TCHAR ) ' \0 ' ; strFilter += _T ( " " ) ; strFilter += ( TCHAR ) ' \0 ' ; dlgFile . m_ofn . nMaxCustFilter ++ ; dlgFile . m_ofn . lpstrFilter = strFilter ; dlgFile . m_ofn . lpstrTitle = title ; dlgFile . m_ofn . lpstrFile = fileName . GetBuffer ( _MAX_PATH ) ; int nResult = dlgFile . DoModal ( ) ; fileName . ReleaseBuffer ( ) ; delete pDlg ; return nResult == IDOK ; }
This function is copied from MFC's docmgr.cpp, w/one minor
modifcation to use CFileDialogEx.
This function is copied from MFC ' s docmgr . cpp w / one minor modifcation to use CFileDialogEx .
// modified 5-15-99 PD: call virtual fn to create dialog
 // do for all doc template
 /////////////////////////////////////////////////////////////////////////////
 // mch 6.2.02
 // add additional "old" *.lab filter
 //	strFilter = strFilter.Left (strFilter.GetLength () - 1) + ";*.lab" + (TCHAR)'\0';
 /////////////////////////////////////////////////////////////////////////////
 // append the "*.*" all files filter
 // next string please
 // last string
 // modified 5-15-00 PD: delete dialog
