<p style={font-size:20pt}><br>我不服!!!!!!!!<br></p><br><p style={font-size:10pt}><br>SelectDirectory函数是overload的,我不过Copy错了而已。。。。<br><br>Win95系统的那个如下:<br><br>源代码:<br>unit FileCtrl;<br>...<br>function SelectDirectory(const Caption: string; const Root: WideString;<br> out Directory: string): Boolean;<br>var<br> WindowList: Pointer;<br> BrowseInfo: TBrowseInfo;<br> Buffer: PChar;<br> RootItemIDList, ItemIDList: PItemIDList;<br> ShellMalloc: IMalloc;<br> IDesktopFolder: IShellFolder;<br> Eaten, Flags: LongWord;<br>begin<br> Result := False;<br> Directory := '';<br> FillChar(BrowseInfo, SizeOf(BrowseInfo), 0);<br> if (ShGetMalloc(ShellMalloc) = S_OK) and (ShellMalloc <> nil) then<br> begin<br> Buffer := ShellMalloc.Alloc(MAX_PATH);<br> try<br> RootItemIDList := nil;<br> if Root <> '' then<br> begin<br> SHGetDesktopFolder(IDesktopFolder);<br> IDesktopFolder.ParseDisplayName(Application.Handle, nil,<br> POleStr(Root), Eaten, RootItemIDList, Flags);<br> end;<br> with BrowseInfo do<br> begin<br> hwndOwner := Application.Handle;<br> pidlRoot := RootItemIDList;<br> pszDisplayName := Buffer;<br> lpszTitle := PChar(Caption);<br> ulFlags := BIF_RETURNONLYFSDIRS;<br> end;<br> WindowList := DisableTaskWindows(0);<br> try<br> ItemIDList := ShBrowseForFolder(BrowseInfo);<br> finally<br> EnableTaskWindows(WindowList);<br> end;<br> Result := ItemIDList <> nil;<br> if Result then<br> begin<br> ShGetPathFromIDList(ItemIDList, Buffer);<br> ShellMalloc.Free(ItemIDList);<br> Directory := Buffer;<br> end;<br> finally<br> ShellMalloc.Free(Buffer);<br> end;<br> end;<br>end;<br><br>你自己说,哪个是"最快最好的回答"!!!!!!!!<br></p><br>