那位同僚有这东东,我真是急着要用。
在下感激不尽

解决方案 »

  1.   

    是不是这个?
    uses shlapi;Function TForm1.GetPath: string;
    var
        bInfo: ^BROWSEINFO;
        FolderName: array[0..MAX_PATH] of char;
        DirPath: array[0..MAX_PATH] of char;
        ItemID: PITEMIDLIST;
    begin
        DirPath := '';
        bInfo := AllocMem(sizeof(BROWSEINFOA));
        bInfo.hwndOwner := Handle;
        bInfo.pszDisplayName := FolderName;
        bInfo.lpszTitle := '请选择文件夹';
        ItemID := SHBrowseForFolder(bInfo^);
        if ItemID <> nil then
        begin
            SHGetPathFromIDList(ItemID, DirPath);
            FreeMem(bInfo, sizeof(BROWSEINFOA));
        end;
        Result := Dirpath;
    end;