16,551
社区成员
发帖
与我相关
我的任务
分享
::GetPrivateProfileString("文件1", "保存地址", "Error", m_strSavePath.GetBuffer(100), 100,
strPath + "\\SaveFile.ini");
BrowseFile(m_strSavePath);
m_strSaveRecPath.Replace("\\", "\\\\"); //将单斜杠替换为双斜杠
void CDlg::BrowseFile(CString strDir)
{
CFileFind ff;
BOOL bFound = ff.FindFile(strDir + "\\*.*");//先根据路径判断查找的文件(或文件夹)是否存在
while(bFound)
{//若为TRUE,则查找下一个文件
bFound = ff.FindNextFile();
if(!ff.IsDirectory() && !ff.IsDots())
{//如果目标不是文件夹且不是一个默认(缺省)文件夹目录,证明这是一个文件,可对它进行处理
CString sFilePath = ff.GetFilePath(); //先获得当前文件的路径
((CListBox*)GetDlgItem(LIST_FILE))->InsertString(0, sFilePath); //将其添加到ListBox控件中
((CListBox*)GetDlgItem(LIST_FILE))->SetCurSel(0);
}
}
ff.Close();
}