就是像安装文件时的那种选择

解决方案 »

  1.   

    你可以调用这个函数SHBrowseForFolder,在MSDN里面有这个函数的详细说明,以下是MSDN里面的一部分说明:
    SHBrowseForFolder
    Displays a dialog box that enables the user to select a shell folder. 
    LPITEMIDLIST SHBrowseForFolder(
    LPBROWSEINFO lpbi
    ); Parameters
    lpbi 
    [in] Pointer to a BROWSEINFO structure that contains information used to display the dialog box. 
    Return Values
    Returns a pointer to an ITEMIDLIST structure (PIDL) that specifies the location of the selected folder relative to the root of the namespace. If the user chooses the Cancel button in the dialog box, the return value is NULL.Res
    You must initialize COM using CoInitializeEx with the COINIT_APARTMENTTHREADED flag on dwCoInit set prior to calling SHBrowseForFolder. You can also use CoInitialize or OLEInitialize, which always use apartment threading.The calling application is responsible for freeing the returned PIDL with the shell allocator's IMalloc::Free method. To get a handle to the shell allocator's IMalloc interface, call SHGetMalloc. See The Shell Namespace for further discussion of the shell allocator and PIDLs.There are two styles of dialog box available. The older style is displayed by default, and is not resizable. To specify a new-style dialog box, set the BIF_USENEWUI flag in the ulFlags member of the BROWSEINFO structure. It has a number of additional features, including: drag and drop capability within the dialog box, reordering, context menus, new folders, delete, and other context menu commands. Initially, it is larger than the old dialog box, but can be resized by the user.If you implement a callback function, you will receive a handle to the dialog box. One use of this window handle is to modify the layout or contents of the dialog box. Because it is not resizable, modifying the old-style dialog box is relatively straightforward. Modifying the new-style dialog box is much more difficult, and not recommended. Not only does it have a different size and layout than the old style, but its dimensions and the positions of its controls change every time it is resized by the user.If the BIF_RETURNONLYFSDIRS flag is set in the ulFlags member of the BROWSEINFO structure, the OK button will remain enabled for "\\server" items, as well as "\\server\share" and directory items. However, if the user selects a "\\server" item, passing the PIDL returned by the dialog box to SHGetPathFromIDList will fail.See Also
    Open and Save Common Dialog BoxesRequirements 
      Version 4.00 and later of Shell32.dll  Windows NT/2000: Requires Windows NT 4.0 or later. 
      Windows 95/98: Requires Windows 95 or later. 
      Header: Declared in shlobj.h. 
      Import Library: shell32.lib.
      

  2.   

    你可以去www.vckabse.com下载代码.
      

  3.   

    调用CWnd: : DlgDirList或者CWnd: : DlgDirListComboBox,Windows 将自动地向列表框或组合框填充可用的驱动器名或者指定目录中的文件,下例将Windows目录中的文件填充在组合框中:
    BOOL CSampleDlg::OnInitDialog()
    {
     CDialog::OnInitDialog();
     TCHAR szPath [MAX_PATH] = {"C:\\WINNT"};
     int nReslt = DlgDirListComboBox(szPath,IDC_COMBO,IDC_CURIDIR,DDL_READWRITE|DDL_READONLY|DDL_HIDDEN|DDL_SYSTEM|DDL_ARCHIVE);
     return TRUE;
    }
      

  4.   

    CJLib 有现成的控件源代码