解説
フォルダ内に存在する全てのフォルダ名を取得する。
得られる結果はフォルダ名順に並んでいるわけではない。そのため必要に応じて
並べ替える必要がある。
使用例
bool GetAllFolderFromFolder(CStringArray& astrFolders,CString strFolder);
//フォルダ内にあるフォルダを列挙
void test(void)
{
int i;
CString strText;
CStringArray astrFolders;
GetAllFolderFromFolder(astrFolders,"c:\\");
for(i = 0; i < astrFolders.GetSize(); i++)
{
strText += astrFolders[i];
strText += "\n";
}
AfxMessageBox(strText);
}
//
// フォルダ内のフォルダを列挙
//
bool GetAllFolderFromFolder(CStringArray& astrFolders,CString strFolder)
{
BOOL bContinue;
CFileFind cFind;
astrFolders.RemoveAll();
if(strFolder.Right(1) != "\\")
strFolder += "\\";
strFolder += "*.*";
bContinue = cFind.FindFile(strFolder);
while(bContinue)
{
bContinue = cFind.FindNextFile();
if(cFind.IsDirectory() != FALSE)
astrFolders.Add(cFind.GetFilePath());
}
return true;
}







