可是CFileDialog必须选择一个文件才行,我不用选择文件,我只需要选择目录就行了。

解决方案 »

  1.   

    这个函数,参考一下:
    SelectFolder()
    {
             char m_szSelected[MAX_PATH];
    LPITEMIDLIST pidl;
    if ((pidl = ::SHBrowseForFolder(&m_bi)) != NULL)
    {
    CString m_strPath;
    if (SUCCEEDED(::SHGetPathFromIDList(pidl, m_szSelected)))
    {
    m_strPath = m_szSelected;
    } LPMALLOC pMalloc;
    //Retrieve a pointer to the shell's IMalloc interface
    if (SUCCEEDED(SHGetMalloc(&pMalloc)))
    {
    // free the PIDL that SHBrowseForFolder returned to us.
    pMalloc->Free(pidl);
    // release the shell's IMalloc interface
    (void)pMalloc->Release();
    }
    }
    }
      

  2.   

    忘了一点:
    BROWSEINFO m_bi;
      

  3.   

    我的Email:[email protected]
    上面写的是完整的类???
      

  4.   

    CListBox和CComboBox的Dir()方法,可以得到驱动器,然后可以用FindFirstFile,FindNextFile得到所有的文件了
      

  5.   

    我的Email:[email protected]
    请问kane_yj可否给我也发这个类,多谢!!