使用选择文件夹对话框

这是如何在VC下使用选择文件夹对话框,返回文件夹的地址的代码:

CString BrowseDirectory( LPCTSTR title )
{
    char dir[MAX_PATH];
    dir[0]='0';

    BROWSEINFO bi;
    bi.hwndOwner=NULL;
    bi.pidlRoot=NULL;
    bi.pszDisplayName=dir;
    bi.lpszTitle=title;
    bi.ulFlags=0;
    bi.lpfn=NULL;
    bi.lParam=NULL;
    bi.iImage=NULL;

    SHGetPathFromIDList(SHBrowseForFolder(&bi),dir);
    return dir;
}

Eric Zhiqiang Ma

Eric is interested in building high-performance and scalable distributed systems and related technologies. The views or opinions expressed here are solely Eric's own and do not necessarily represent those of any third parties.

Leave a Reply

Your email address will not be published. Required fields are marked *