16,472
社区成员
发帖
与我相关
我的任务
分享
void CTestHookDlg::FileType(CString& strDir)
{
CFileFind cff,cff1;
CString szDir = strDir;
CString str;
if(szDir.Right(1) != "\\")
szDir += "\\";
szDir += "*.*";
BOOL bResult = cff.FindFile(szDir);
int i=1;
while(bResult)
{
bResult = cff.FindNextFile();
if(cff.IsDirectory() && !cff.IsDots())
{
CString strPath=cff.GetFilePath();
FileType(strPath);
CString type="*.xls";
CString q;
strPath+="\\";
q=strPath+type;
BOOL result=cff1.FindFile(q);
while (result)
{
result=cff1.FindNextFile();
if (!cff1.IsDirectory() && !cff1.IsDots())
{
str_path.Format("%s",cff1.GetFilePath());
AfxMessageBox(str_path);
CString str;
str.Format("%d",i);
::WritePrivateProfileString("ewr",str,str_path,"D:\\qaws.ini");
i++;
}
}
}
str="";
}
cff.Close();
}