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());
}
}
Note: Most of the material in this article is taken from codeguru.com
Recommended Reading :