本文主要是介绍MFC 另存为,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
//选择保存文件的路径void MainDlg::OnBnClickedButtonNewhold()
{
// TODO: 在此添加控件通知处理程序代码
BROWSEINFO broInfo = {0};
TCHAR szDisName[MAX_PATH] = {0};
broInfo.hwndOwner = this->m_hWnd;
broInfo.pidlRoot = NULL;
broInfo.pszDisplayName = szDisName;
broInfo.lpszTitle = _T("选择保存路径");
broInfo.ulFlags = BIF_NEWDIALOGSTYLE | BIF_DONTGOBELOWDOMAIN
| BIF_BROWSEFORCOMPUTER | BIF_RETURNONLYFSDIRS | BIF_RETURNFSANCESTORS;
broInfo.lpfn = NULL;
broInfo.lParam = NULL;
broInfo.iImage = IDR_MAINFRAME;
LPITEMIDLIST pIDList = SHBrowseForFolder(&broInfo);
if (pIDList != NULL)
{
memset(szDisName, 0, sizeof(szDisName));
SHGetPathFromIDList(pIDList, szDisName);
m_strFolderPath = szDisName; //m_strFolderPath 为点击保存的文件路径
}
}
这篇关于MFC 另存为的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!