#mfc文本查看小工具制作(1)-搜索文件,遍历文件夹,文件列表存入listcontrol。
1.打开文件,遍历文件夹操作。(打开你想要的目标文件或文本文档)
CFileFind finder;
BOOL isNotEmpty = finder.FindFile((strFolderPath + _T("\\") + _T("*.*")));//总文件夹,开始遍历
m_ListCtrl.DeleteAllItems();
while (isNotEmpty)
{
isNotEmpty = finder.FindNextFile();//查找文件
TRACE(_T("%s\n"), (LPCTSTR)finder.GetFileName());
CString filename = finder.GetFileName();//获取文件的路径,可能是文件夹&