TCHAR szFilters[]= _T("All Files (*.*)|*.*||"); // Create an Open dialog; the default file name extension is ".my". CFileDialog fileDlg(TRUE, _T("abc"), _T("你的文件名"), OFN_FILEMUSTEXIST | OFN_HIDEREADONLY, szFilters); // Display the file dialog. When user clicks OK, fileDlg.DoModal() // returns IDOK. if(fileDlg.DoModal() == IDOK) { CString pathName = fileDlg.GetPathName(); // Implement opening and reading file in here. //Change the window's title to the opened file's title. CString fileName = fileDlg.GetFileTitle(); SetWindowText(fileName); }
指定CFileDialog弹出来时文件名编辑框里面的文字
最新推荐文章于 2023-07-14 09:52:37 发布