//获取当前路径
CString strCurrentPath;
GetCurrentDirectory(200, strCurrentPath.GetBuffer(200));
strCurrentPath.ReleaseBuffer(); //m_EditHouseName.GetWindowText();
static char sfile[] = "Excel文件(*.xls)|*.xls|记事本文件(*.txt)|*.txt||";
CString filename;
CFileDialog fileDlg(FALSE, "xls", "HouseInfo.xls", OFN_OVERWRITEPROMPT, sfile, this); fileDlg.m_ofn.lpstrInitialDir = strCurrentPath; /// 这里就设置了对话框的默认目录为strCurrentPath
if (IDOK == fileDlg.DoModal())
{
filename = fileDlg.GetPathName();
MessageBox(filename);
//saveExcel(filename);
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货