Simplest method to create an OpenFileDialog and re

2020-04-21 03:51发布

How to create a MFC application in which I want to implement an OpenFileDialog box and the resultant path name to be displayed on the edittext box.

标签: c++ mfc
1条回答
疯言疯语
2楼-- · 2020-04-21 04:36

Here is an example that will help you get started:

const TCHAR szFilter[] = _T("CSV Files (*.csv)|*.csv|All Files (*.*)|*.*||");
CFileDialog dlg(FALSE, _T("csv"), NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, szFilter, this);    
if(dlg.DoModal() == IDOK)
{
    CString sFilePath = dlg.GetPathName();
    m_FilePathEditBox.SetWindowText(sFilePath);
}
查看更多
登录 后发表回答