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.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
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);
}