MFC Doc/View: How to modify the default 'Open' dialog?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

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

Threaded View

  1. #1
    ovidiucucu's Avatar
    ovidiucucu is offline Moderator/Reviewer Power Poster
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,059

    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 06: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
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center