void CWriteWnd::OpenFileDialog()
{
OPENFILENAME ofn;
TCHAR szFile[MAX_PATH] = _T("");
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = *this;
ofn.lpstrFile = szFile;
ofn.nMaxFile = sizeof(szFile);
ofn.lpstrFilter = NULL;
ofn.nFilterIndex = 1;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
ofn.lpstrInitialDir = NULL;
ofn.Flags = OFN_EXPLORER | OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
GetOpenFileName(&ofn);
/*if (GetOpenFileName(&ofn))
{
std::vector<wstring> vctString(1, szFile);//保存添加文件的路径
}*/
}
相关文章
- 11-02MFC对话框的Edit控件实现响应Ctrl+A全选,并实现自动/手动换行+滚动条
- 11-02MFC中Picture Control控件的使用(通过文件对话框CFileDialog获取图片文件)
- 11-02Win32 DLL和MFC DLL 中封装对话框
- 11-02不用splitter控件 简单实现对mfc对话框的分割的方法
- 11-02Win32 实现 MFC CFileDialog 对话框
- 11-02MFC对话框程序:实现程序启动画面
- 11-02[转]用多线程方法实现在MFC/WIN32中调用OpenGL函数并创建OpenGL窗口
- 11-02实现MFC扩展DLL中导出类和对话框
- 11-02VS2008基于对话框的MFC上位机串口通信(C++实现)简单例程