CString strbmpfile = "2*2大屏幕拼接配置 (*.2xml)|*.2xml";
CFileDialog dlgOpen(TRUE,NULL,NULL, OFN_PATHMUSTEXIST | OFN_HIDEREADONLY, strbmpfile, this);
CString CollocateFileName;
dlgOpen.m_ofn.lpstrInitialDir =(LPCTSTR)"C:\\asdasd"; //设置默认的打开文件路径
dlgOpen.m_ofn.lpstrTitle="读取配置设置信息";
if (IDOK == dlgOpen.DoModal())
{
CollocateFileName=dlgOpen.GetFileName();
}
判断文件夹是否存在 PathIsDirectory 头文件是Shlwapi.h ,加入Shlwapi.lib
//首先判断文件夹是否存在
CString m_strFolderPath;
m_strFolderPath=".\\"+m_xmlNodeTime;
if (!PathIsDirectory(m_strFolderPath) ) //判断文件夹是否存在
{
if (!CreateDirectory(m_strFolderPath, NULL ) ) //没有则创建改文件夹
{
AfxMessageBox("创建文件夹失败,请管理详细检查!");
}
}
打开网上邻居
CFileDialog dlg(true, "", NULL, OFN_OVERWRITEPROMPT|OFN_HIDEREADONLY, "All(*.*)|*.*; |EXE(*.exe, *.msi)|*.exe;*.msi||", 0) ;
dlg.m_ofn.lpstrInitialDir = "::{208D2C60-3AEA-1069-A2D7-08002B30309D}" ; //这里设置默认路径为网络邻居