# CodeGuru Technical FAQs > CodeGuru Individual FAQs >  MFC Doc/View: How to modify the default 'Open' dialog?

## ovidiucucu

*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:


```
ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
```

Using ClassWizard map yourself ID_FILE_OPEN command
Write this code in ID_FILE_OPEN handler function: 


```
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());
   }
}
```

----------


## ovidiucucu

*A:* 
Another solution is to derive from CDocManager and override CDocManager::DoPromptFileName.
In the overridden DoPromptFileName, we can either write our own implementation or modify some parameters then call the base class method.
Finally, in InitInstance of application, replace the call to AddDocTemplate as shown below.

Next example changes the default dialog title and shows "Help" button.


```
class CCustomDocManager : public CDocManager
{
public:
   virtual BOOL DoPromptFileName(CString& fileName, UINT nIDSTitle,
               DWORD lFlags, BOOL bOpenFileDialog, CDocTemplate* pTemplate);
};
```



```
BOOL CCustomDocManager::DoPromptFileName(CString& fileName, UINT nIDSTitle,
               DWORD lFlags, BOOL bOpenFileDialog, CDocTemplate* pTemplate)
{
   // set the custom title
   nIDSTitle = bOpenFileDialog ? IDS_CUSTOM_OPEN_TITLE : IDS_CUSTOM_SAVEAS_TITLE;
   // add "show Help button" flag
   lFlags |= OFN_SHOWHELP;          
   // call the base class function
   return CDocManager::DoPromptFileName(fileName, nIDSTitle,
                                 lFlags, bOpenFileDialog, pTemplate);
}
```



```
BOOL CMyApp::InitInstance()
{
// ...
   // AddDocTemplate(pDocTemplate); // <-- replace this
   if (m_pDocManager == NULL)
   {
      m_pDocManager = new CCustomDocManager;
   }
   m_pDocManager->AddDocTemplate(pDocTemplate);
// ...
```

----------

