例:
我的电脑
    c:\
    D:\
    E:\
       win.ini
       ..........

解决方案 »

  1.   

    _findfirst
    _findnext
    _findclose
      

  2.   

    请问find系列函数如何改变当前的路径?
      

  3.   

    //列出某个目录的子目录
    void CMyBar::ListChildDir(LPCTSTR seekdir,HTREEITEM parent,int SeekMode)
    {
    CString mystr;
    CString tempstr;
    CFileFind myfind;
    BOOL findret = 0;
    mystr = seekdir ;
    mystr += "*.*";
    findret = myfind.FindFile(mystr);
    while(findret){
    findret = myfind.FindNextFile();
    tempstr = myfind.GetFileName();
    //if(GetFileAttributes(tempstr) == FILE_ATTRIBUTE_DIRECTORY)
    if((tempstr.GetLength() > 2)){
    tempstr = seekdir + tempstr;
    if(GetFileAttributes(tempstr) == FILE_ATTRIBUTE_DIRECTORY){
    tempstr += "\\";
    HTREEITEM chtItem = m_wndChild.InsertItem(tempstr,2,2,parent,TVI_LAST);
    m_wndChild.SetItemData(chtItem,(DWORD)TREE_DIR_NODE);
    ListChildDir(tempstr,chtItem,SeekMode);
    if(SeekMode){
                                         //listfile
    }else{
    //listfile
    }
    }
    }
    }
    }我以前写的用递归实现的列出一个目录的所有子目录
      

  4.   

    你可以自己在里面加上列出文件的一段就在if(GetFileAttributes(tempstr) == FILE_ATTRIBUTE_DIRECTORY){}  这段函数的后面,把文件结点加到父目录下就可以了