Board index » delphi » List of computers on Network

List of computers on Network

RaVe,

Not quick and easy, but it's possible. See the Win32 API help file
topic "WNetEnumResource".

Ken
--
Ken White

Clipper Functions for Delphi
http://members.aol.com/clipfunc

Quote
RaVe N MaDD wrote:

> Is there a quick and easy way to grab a list of the machines currently
> attached to a LAN?  I am attempting to add the console command line function
> "net time \\<machine_name> /set /yes" to a D3 app, but would like to allow
> the user to pick from a list of machines currently on the LAN.

 

Re:List of computers on Network


Hello,
Try this:

unit BrowseComp;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ShlObj,
  StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Label1: TLabel;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
var
  IDList: PItemIDList;
 BrowseInfo: TBrowseInfo;
  DisplayName: array[0..MAX_PATH] of char;
begin
  BrowseInfo.hwndOwner      := Form1.Handle;
  BrowseInfo.pidlRoot       := nil;
  BrowseInfo.pszDisplayName := DisplayName;
  BrowseInfo.lpszTitle      := 'Choose a computer';
  BrowseInfo.ulFlags        := BIF_BROWSEFORCOMPUTER;
  BrowseInfo.lpfn           := nil;
  BrowseInfo.lParam         := 0;

  IDList := SHBrowseForFolder(BrowseInfo);
  Label1.Caption := BrowseInfo.pszDisplayName;
end;

end.

Michal

Quote
RaVe N MaDD wrote:
> Is there a quick and easy way to grab a list of the machines currently
> attached to a LAN?  I am attempting to add the console command line function
> "net time \\<machine_name> /set /yes" to a D3 app, but would like to allow
> the user to pick from a list of machines currently on the LAN.

Other Threads