我也想要,先谢谢了 ,[email protected]

解决方案 »

  1.   

    我也要,请发到; [email protected] 谢了
      

  2.   

    Try to use it//
    // Display a dialog box allowing the user to choose a computer (not a drive,
    // printer, etc. but just a computer in the network).
    //
    // Args: parent window (usually TForm.Handle)
    //       caption to display on the dialog box,  e.g. Choose Cache Server
    //
    // Returns: computer chosen
    //          empty string on error or no computer chosen
    //
    function ChooseComputer(parent_window: HWND; caption: String): String;
    begin
         Result:=NetworkBrowsing(parent_window, caption, BIF_BROWSEFORCOMPUTER);
    end;//
    // Display a dialog box allowing the user to choose a share on a network
    //
    // Args: parent window (usually TForm.Handle)
    //       caption to display on the dialog box, e.g. Choose share
    //
    // Returns: share chosen
    //          empty string on error or no share chosen
    //
    function ChooseShare(parent_window: HWND; caption: String): String;
    begin
         Result:=NetworkBrowsing(parent_window, caption, BIF_RETURNONLYFSDIRS);
    end;//
    // Display a dialog box allowing the user to choose a computer, network drive,
    // etc.
    //
    // Args: parent window (usually TForm.Handle)
    //       caption to display on the dialog box, e.g. Choose Cache Server
    //       what to browse for (e.g. BIF_BROWSEFORCOMPUTER for computers)
    //
    // Returns: computer chosen
    //          empty string on error or no computer chosen
    //
    // Note: typical browse_for values are
    //
    //   BIF_RETURNONLYFSDIRS for networked folders
    //   BIF_BROWSEFORCOMPUTER for computers
    //
    function NetworkBrowsing(parent_window: HWND; caption: String; browse_for: Integer): String;
    var lpbi: _browseInfo;
        dn: String;
        idlist: ITEMIDLIST;
        ridlist: PITEMIDLIST;
        ppMalloc: IMalloc;
    begin
         try
            // Get pointer to network root
            SHGetSpecialFolderLocation(parent_window, CSIDL_NETWORK, PITEMIDLIST(idlist));        // Initialise & display dialog box
            lpbi.hwndOwner:=parent_window;
            lpbi.pidlRoot:=PITEMIDLIST(idlist);
            SetLength(dn, 255);
            lpbi.pszDisplayName:=PChar(dn);
            lpbi.lpszTitle:=PChar(caption);
            lpbi.ulFlags:=browse_for;
            lpbi.lpfn:=nil;
            ridlist:=SHBrowseForFolder(lpbi);        // Store the resuls
    {xxx
            if browse_for <> BIF_BROWSEFORCOMPUTER then begin
               // Return the complete network path
               SetLength(Result, 255);
               SHGetPathFromIDList(ridlist, PChar(Result));
            end else
    }
               // Return only the name of the 'thing' selected
               Result:=lpbi.pszDisplayName;        // Free memory
            if ridlist=nil then
               Result:=''
            else begin
               SHGetMalloc(ppMalloc);
               ppMalloc.Free(ridlist);
            end;
         except
            // Oops
            Result:='';
         end;
    end;
      

  3.   

    我也要,请发到; [email protected] 谢了
      

  4.   

    试试看
    //
    // Display a dialog box allowing the user to choose a computer, network drive,
    // etc.
    //
    // Args: parent window (usually TForm.Handle)
    //       caption to display on the dialog box, e.g. Choose Cache Server
    //       what to browse for (e.g. BIF_BROWSEFORCOMPUTER for computers)
    //
    // Returns: computer chosen
    //          empty string on error or no computer chosen
    //
    // Note: typical browse_for values are
    //
    //   BIF_RETURNONLYFSDIRS for networked folders
    //   BIF_BROWSEFORCOMPUTER for computers
    //
    function NetworkBrowsing(parent_window: HWND; caption: String; browse_for: Integer): String;
    var
      lpbi: _browseInfo;
      dn: String;
      idlist: ITEMIDLIST;
      ridlist: PITEMIDLIST;
      ppMalloc: IMalloc;
    begin
      try
        // Get pointer to network root
        SHGetSpecialFolderLocation(parent_window, CSIDL_NETWORK, PITEMIDLIST(idlist));
        // Initialise & display dialog box
        lpbi.hwndOwner:=parent_window;
        lpbi.pidlRoot:=PITEMIDLIST(idlist);
        SetLength(dn, 255);
        lpbi.pszDisplayName:=PChar(dn);
        lpbi.lpszTitle:=PChar(caption);
        lpbi.ulFlags:=browse_for;
        lpbi.lpfn:=nil;
        ridlist:=SHBrowseForFolder(lpbi);
        // Store the resuls
        {xxx
        if browse_for <> BIF_BROWSEFORCOMPUTER then begin
        // Return the complete network path
        SetLength(Result, 255);
        SHGetPathFromIDList(ridlist, PChar(Result));
        end else
        }
        // Return only the name of the 'thing' selected
        Result:=lpbi.pszDisplayName;
        // Free memory
        if ridlist=nil then
          Result:=''
        else begin
          SHGetMalloc(ppMalloc);
          ppMalloc.Free(ridlist);
        end;
      except
        // Oops
        Result:='';
      end;
    end;
    //
    // Display a dialog box allowing the user to choose a computer (not a drive,
    // printer, etc. but just a computer in the network).
    //
    // Args: parent window (usually TForm.Handle)
    //       caption to display on the dialog box,  e.g. Choose Cache Server
    //
    // Returns: computer chosen
    //          empty string on error or no computer chosen
    //
    function ChooseComputer(parent_window: HWND; caption: String): String;
    begin
      Result:=NetworkBrowsing(parent_window, caption, BIF_BROWSEFORCOMPUTER);
    end;
    //
    // Display a dialog box allowing the user to choose a share on a network
    //
    // Args: parent window (usually TForm.Handle)
    //       caption to display on the dialog box, e.g. Choose share
    //
    // Returns: share chosen
    //          empty string on error or no share chosen
    //
    function ChooseShare(parent_window: HWND; caption: String): String;
    begin
      Result:=NetworkBrowsing(parent_window, caption, BIF_RETURNONLYFSDIRS);
    end;
      

  5.   

        在Delphi中是不会有API函数的,API函数指的是Windows所带的应用程序编程接口。实际上你的问题已经有人问过,在旧版的CSDN中有过这样的专题,我拥有该专题的所有代码,如果你要的话,我可以将它录入计算机然后再发E-mail给你。
        Have a good time!
      

  6.   

    没有API的话DELPHI还玩个屁,英雄,摆脱你自己查一下你自己平常调用的函数在DELPHI中是如何写的。还是API,那你说你调的不是DELPHI函数。