CDirDialog  PathDlg;
if (PathDlg.DoBrowse(this) == IDOK)
 m_DataOutPathCtr.SetWindowText(PathDlg.m_strPath);

解决方案 »

  1.   

    给你一段完整的代码看看:char  lpBuffer[MAX_PATH], buf[1024]; 
    LPMALLOC pMalloc;
    SHGetMalloc(&pMalloc);BROWSEINFO bi;
    int i = 0;
    LPITEMIDLIST pidlBrowse;    // PIDL selected by user  memset(lpBuffer, 0, sizeof(lpBuffer));
    memset(buf, 0, sizeof(buf));

    // Fill in the BROWSEINFO structure.
    bi.hwndOwner = m_hWnd; 
    bi.pidlRoot = NULL;
    bi.pszDisplayName = lpBuffer; 
    bi.lpszTitle = "选择HTML文件存放的目录";
    bi.ulFlags = 0; 
    bi.lpfn = NULL;
    bi.lParam = 0;  
        
    // Browse for a folder and return its PIDL. 
    pidlBrowse = SHBrowseForFolder(&bi);
    if (pidlBrowse != NULL)
    {  
            // Show the display name, title, and file system path. 
            if (SHGetPathFromIDList(pidlBrowse, lpBuffer)) 
                //you got the path here         // Free the PIDL returned by SHBrowseForFolder. 
            pMalloc->Free(pidlBrowse);}
      

  2.   

    The CFileDialog class encapsulates the Windows common file dialog box. Common file dialog boxes provide an easy way to implement File Open and File Save As dialog boxes (as well as other file-selection dialog boxes) in a manner consistent with Windows standards
      

  3.   

    嘻嘻,我这儿有
    BROWSEINFO browse;
    ZeroMemory(&browse,sizeof(browse)); CString m_strPath;
    browse.hwndOwner = NULL;
    browse.pszDisplayName = m_strPath.GetBuffer(MAX_PATH);
    browse.lpszTitle = "请您选择一个目录"; LPITEMIDLIST lpItem = SHBrowseForFolder(&browse);
    if(lpItem == NULL) return ; m_strPath.ReleaseBuffer();
    if(SHGetPathFromIDList(lpItem,m_strPath.GetBuffer(MAX_PATH)) == false) return; m_strPath.ReleaseBuffer();