CComboBox dir;
dir.Create(WS_CHILD|WS_VISIBLE|WS_VSCROLL|CBS_DROPDOWNLIST,
      CRect(0,0,0,0), this, 1);
dir.Dir(DDL_DRIVES,"");
//
CString str = "";
char *ch = NULL;

int count = dir.GetCount();
ch = new char[count];
memset(ch,0,count);
HTREEITEM htItem;
CFileFind filefind;
for( int i = 0; i < count; i++ )
{
dir.GetLBText(i,str);
ch[i] = str.GetAt(2);
str.Format("%c:",ch[i]);
htItem = NULL;
htItem = m_FileTree.InsertItem(str); CString strDir = "";
CString strWildCard = "\\*.*";
strDir = str + strWildCard;
BOOL bWorking;
bWorking = filefind.FindFile(strDir);
while( bWorking )
{
CString strFile = "";
bWorking = filefind.FindNextFile();

if( filefind.IsDirectory() )
{
strFile = filefind.GetFileName();
m_FileTree.InsertItem(strFile,htItem);
}
else
continue;
}
}
filefind.Close();
delete []ch;
//这是在对话框的InitiaDialog中创建树的。在展开树时,我们要显示树的下级目录:
//我是从载树的:
void CMyTreeCtrl::Dir()
{
CString str = "";
HTREEITEM htItem = NULL;
HTREEITEM htchdItem = NULL;
htItem = GetSelectedItem();
htchdItem = this->GetChildItem(htItem);
CFileFind filefind;
if( htchdItem == NULL ) 
ReadCurSel();
else
{
while( htchdItem )
{
HTREEITEM htempItem = htchdItem;
str = "";
do
{
str.Insert( 0, GetItemText(htempItem) + "\\" );
htempItem = GetParentItem(htempItem);
}while( htempItem ); CString strDir = "";
strDir = str + "*.*";
BOOL bWorking = FALSE;
bWorking = filefind.FindFile(strDir);
while( bWorking )
{
CString strFile = "";
bWorking = filefind.FindNextFile();

if( filefind.IsDots() )
continue;
else 
{
strFile = filefind.GetFileName();
InsertItem(strFile,htchdItem);
}

}
htchdItem = this ->GetNextSiblingItem(htchdItem);
}
}
filefind.Close();
Expand(htItem,TVE_TOGGLE   );
}