> Modify the code below to only scan the current workgroup:
> procedure EnumNetResources(List: TStrings);
> procedure EnumFunc(NetResource: PNetResource);
> var
> Enum: THandle;
> Count, BufferSize: DWORD;
> Buffer: array[0..16384 div SizeOf(TNetResource)] of TNetResource;
> i: Integer;
> begin
> if WNetOpenEnum(RESOURCE_GLOBALNET, RESOURCETYPE_ANY, 0, NetResource,
> Enum) = NO_ERROR then
> try
> Count := $FFFFFFFF;
> BufferSize := SizeOf(Buffer);
> while WNetEnumResource(Enum, Count, @Buffer, BufferSize) = NO_ERROR
do
> for i := 0 to Count - 1 do
> begin
> if Buffer[i].dwDisplayType = RESOURCEDISPLAYTYPE_SERVER then
> List.Add(Buffer[i].lpRemoteName);
> if (Buffer[i].dwUsage and RESOURCEUSAGE_CONTAINER) > 0 then
> EnumFunc(@Buffer[i])
> end;
> finally
> WNetCloseEnum(Enum);
> end;
> end;
> begin
> EnumFunc(nil);
> end;
> procedure TForm1.FormCreate(Sender: TObject);
> begin
> EnumNetResources(ComboBox1.Items);
> end;
> "Ingolf" <DONT_SPAM_ing...@musling.dk> schreef in bericht
> news:WWIA6.31602$o4.2251400@news010.worldonline.dk...
> > Hi
> > How do you get a list of all computers in a localnetwork ? Or just a
list
> > from the workgroup that the user is logged on to ?
> > Just like if you type "net view" in a command box, you get a list of
local
> > computers.
> > I've tried the following...
> > var
> > srec : TSearchRec;
> > iores : integer;
> > begin
> > iores:=findfirst('\\*.*',faAnyfile,srec);
> > while iores=0 do
> > begin
> > memo1.Lines.Add(srec.name);
> > iores:=findnext(srec);
> > end;
> > FindClose(srec);
> > end;
> > But this does not work.
> > Ideas are more than welcome
> > Regards
> > Ingolf