转自https://www.cnblogs.com/nxopen2018/p/11070031.html
//方法1 //转换 //char msg[256]; //sprintf_s(msg, "start %s", strDir.c_str()); //打开并显示文件夹(windows cmd) //system(msg);
//方法2 //ShellExecute打开一个文件 //ShellExecute(NULL, "open", "C:\11.txt", NULL, NULL, SW_SHOWNORMAL); ////ShellExecute打开并显示文件夹 ShellExecute(NULL, "open", strDir.c_str(), NULL, NULL, SW_SHOWNORMAL);
CString strLocalFile = m_temp_path + _T("output.pdf"); CFileDialog dlg(FALSE, _T("*.pdf"), NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, _T("PDF Files (*.pdf)|*.pdf||")); if(dlg.DoModal() == IDOK) { strLocalFile = dlg.GetPathName(); BOOL bRet = CHomeFunc::output_atlas(gHome, strLocalFile); if (bRet) { CString strFolder = dlg.GetFolderPath(); ShellExecute( NULL, _T("open"), strFolder, NULL, NULL, SW_SHOWNORMAL); } }