CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Threaded View

  1. #1
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,234

    MFC Doc/View: How to modify the default 'Open' dialog?

    Q: How to modify the default 'Open' dialog?

    A:
    • Delete or comment the following line added in message map of CWinApp-derived class by the AppWizard:
      Code:
      ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
    • Using ClassWizard map yourself ID_FILE_OPEN command

    • Write this code in ID_FILE_OPEN handler function:
      Code:
      void CMyApp::OnFileOpen() 
      {
         LPCTSTR pszFilter = 
            _T("Bitmap files (*.bmp;*.dib;*.rle)|*.bmp;*.dib;*.rle|")
            _T("JPEG files (*.jpg;*.jpeg;*.jpe;*.jfif)|*.jpg;*.jpeg;*.jpe;*.jfif||");
      
         CFileDialog dlgFile(TRUE, NULL, NULL, 
                             OFN_HIDEREADONLY,
                             pszFilter,
                             AfxGetMainWnd());
      
         if(IDOK == dlgFile.DoModal())
         {
            OpenDocumentFile(dlgFile.GetPathName());
         }
      }



    Last edited by Andreas Masur; September 18th, 2005 at 05:08 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured