64,637
社区成员
发帖
与我相关
我的任务
分享
void CTestImageDemoView::GetAllImageOfComputer(CString strFilePath)
{
strFilePath = m_strImgFilePath;
strFilePath += _T("\\*.*");
CFileFind ff;
BOOL bExist = ff.FindFile(strFilePath);
while (bExist)
{
bExist = ff.FindNextFile();
if(ff.IsDirectory() && !ff.IsDots()) //如果找到的是目录则跳过
{
GetAllImageOfComputer(ff.GetFilePath());
}
else
{
m_vFile.push_back(strFilePath + ff.GetFileName()); //把strFileName下的文件名放进容器
}
}
}
//然后我这样调用
CString strFilePath = _T("D:\\");
GetAllImageOfComputer(strFilePath);