使用MFC应用程序创建OpenFileDialog并将路径名返回到edittext框的最简单方法 [英] Simplest method to create an OpenFileDialog and return the pathname to edittext box using MFC applications

查看:165
本文介绍了使用MFC应用程序创建OpenFileDialog并将路径名返回到edittext框的最简单方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何创建MFC应用程序,在该应用程序中我要实现OpenFileDialog框,并在其中显示要在edittext框上显示的结果路径名.

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.

推荐答案

下面是一个可以帮助您入门的示例:

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);
}

这篇关于使用MFC应用程序创建OpenFileDialog并将路径名返回到edittext框的最简单方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆