uses filectrl;selectdirector

解决方案 »

  1.   

    我用一个很笨的方法:
        用opendialog控件,先选一个文件(此文件夹下的);
        然后用extractfilepath(opendialog.filename)函数来获取这个文件夹;
      

  2.   

    Delphi有类似的控件啊,但对话框就要自己做了。
      

  3.   

    if use(copy_paste) then
      MessageBox('Right! Check-out.', 'Information', MB_OK + MB_ICONINFORMATION);
      

  4.   

    * Prompted
      selectdirector ---- instead ------> SelectDirectory
      

  5.   

    很简单,下一个控件:
    Site:
    http://www.yaoba.com/~masterall/vcl/net/vcl_net.htm
      

  6.   

    直接用opendialog组件,调用
    if opendialog.Execute then
    ……
      

  7.   

    uses ShlObj;//SelectDir(句柄,提示的文字,打开时默认的目录,返回文件路途变量):成功否.
    function SelectDir(ParentHWnd: HWnd; const Caption: string; const Root: WideString;
      out Directory: string): Boolean;
    var
      BrowseInfo: TBrowseInfo;
      Buffer: PChar;
      RootItemIDList, ItemIDList: PItemIDList;
      ShellMalloc: IMalloc;
      IDesktopFolder: IShellFolder;
      Eaten, Flags: LongWord;
    begin
      Result := False;
      Directory := '';
      FillChar(BrowseInfo, SizeOf(BrowseInfo), 0);
      if (ShGetMalloc(ShellMalloc) = S_OK) and (ShellMalloc <> nil) then
      begin
        Buffer := ShellMalloc.Alloc(MAX_PATH);
        try
          SHGetDesktopFolder(IDesktopFolder);
          IDesktopFolder.ParseDisplayName(Application.Handle, nil,
            POleStr(Root), Eaten, RootItemIDList, Flags);
          with BrowseInfo do
          begin
            hwndOwner := ParentHWnd;
            pidlRoot := RootItemIDList;
            pszDisplayName := Buffer;
            lpszTitle := PChar(Caption);
            ulFlags := BIF_RETURNONLYFSDIRS;
          end;
          ItemIDList := ShBrowseForFolder(BrowseInfo);
          Result :=  ItemIDList <> nil;
          if Result then
          begin
            ShGetPathFromIDList(ItemIDList, Buffer);
            ShellMalloc.Free(ItemIDList);
            Directory := Buffer;
          end;
        finally
          ShellMalloc.Free(Buffer);
        end;
      end;
    end;