任何人都可以告诉我mfc中对话框的打开按钮功能代码(可以打开我们PC的目录)

Can any one please tell me the open button functionality code (Which can be open our directory of a PC) of a Dialog box in mfc

我有一个对话框,它包含一个“打开”按钮,当我单击该按钮时,它将重定向到 Windows 资源管理器,我可以在其中选择目录中的任何文件

最低限度是:

CFileDialog dlg(TRUE);
if (IDOK == dlg.DoModal())
{
   CString strFileName = dlg.GetPathName();
   // do stuff with file name
}

我建议您 read/search 更多关于 CFileDialog 的功能。您可以传递过滤器,可以设置标志以允许选择多个文件。但以上可能是 open/select 一个文件的最低限度。