VC 文件对话框打开文件
1 void FileDialogOpen()
2 {
3 static TCHAR szFilter[] =
4 _T("Info Files (*.csv)|*.csv|")
5 _T("Info Files (*.txt)|*.txt|")
6 _T("Info Files (*.csv;*.txt)|*.csv;*.txt|");
7
8 CFileDialog FileDlg(TRUE, NULL,NULL, OFN_HIDEREADONLY|OFN_ENABLESIZING, szFilter);
9
10 if( FileDlg.DoModal() == IDOK ) {
11 m_etPath.SetText(FileDlg.GetPathName());
12 }
13 }
2 {
3 static TCHAR szFilter[] =
4 _T("Info Files (*.csv)|*.csv|")
5 _T("Info Files (*.txt)|*.txt|")
6 _T("Info Files (*.csv;*.txt)|*.csv;*.txt|");
7
8 CFileDialog FileDlg(TRUE, NULL,NULL, OFN_HIDEREADONLY|OFN_ENABLESIZING, szFilter);
9
10 if( FileDlg.DoModal() == IDOK ) {
11 m_etPath.SetText(FileDlg.GetPathName());
12 }
13 }