Hi,
I'm trying to resolve the same question. On my search i found some code that works. It's not exactly what i want but it is a start. If i figured it out i will send you the exact code.
I'm giving you the complete code the only thing you have to is to put a Tbutton and a Tmemo on the form and replace the complete code with the one beneath. The thing i donn't like is the fact that you have to fill in the workgroup. So the next week i will solve the rest of the puzzle (i hope

).
Steph
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
function FindAllComputers(Workgroup : String):string;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var
sList: String;
begin
sList := FindAllComputers('Fill in your workgroup');
Memo1.Lines.Add(sList);
end;
function FindAllComputers(Workgroup : String):string;
Var
EnumHandle : THandle;
WorkgroupRS : TNetResource;
Buf : Array[1..500] of TNetResource;
BufSize : cardinal;
Entries : cardinal;
Res : Integer;
Computer : Tstringlist;
begin
Workgroup := Workgroup + #0;
FillChar(WorkgroupRS, SizeOf(WorkgroupRS) , 0);
With WorkgroupRS do begin
dwScope := 2;
dwType := 3;
dwDisplayType := 1;
dwUsage := 2;
lpRemoteName := @Workgroup[1];
end;
WNetOpenEnum( RESOURCE_GLOBALNET,
RESOURCETYPE_ANY,
0,
@WorkgroupRS,
EnumHandle );
computer:=tstringlist.create;
Repeat
Entries := 1;
BufSize := SizeOf(Buf);
Res :=
WNetEnumResource(EnumHandle, Entries, @Buf, BufSize);
If (Res = NO_ERROR) and (Entries = 1) then
begin
computer.add(StrPas(Buf[1].lpRemoteName));
end;
Until (Entries <> 1) or (Res <> NO_ERROR);
WNetCloseEnum( EnumHandle );
result:=computer.text;
computer.free;
end; { Find All Computers }
end.