CFileDialog::CFileDialog( BOOL bOpenFileDialog, LPCTSTR lpszDefExt = NULL, LPCTSTR lpszFileName = NULL, DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, LPCTSTR lpszFilter = NULL, CWnd* pParentWnd = NULL );
参数意义如下:
void CFoxitDlg::OnBtn3()
{
// TODO: Add your control notification handler code here
CString filter;
filter="文本文档(*.txt)|*.txt|PDF文档(*.pdf)|*.pdf||";
CFileDialog dlg(TRUE,NULL,NULL,OFN_HIDEREADONLY,filter);
if(dlg.DoModal()==IDOK)
{
CString str;
str=dlg.GetPathName();
MessageBox(str);
}
}