Articles   Members Online: 3
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to enumerating workgroups on your LAN Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
12-Sep-03
Category
Internet / Web
Language
Delphi 5.x
Views
170
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Erwin Molendijk 

Enumerating workgroups on your LAN.

Answer:

1   { This code is a copy-paste from a working application.
2   }
3   
4   var
5     WorkgroupCount: Integer;
6     Workgroup: array[1..500] of string[25];
7   
8   procedure FindAllWorkgroups;
9   var
10    EnumHandle: THandle;
11    EntireNetwork: TNetResource;
12    Buf: array[1..500] of TNetResource;
13    BufSize: Integer; // or DWORD;
14    Entries: Integer; // or DWORD;
15  
16  begin
17    FillChar(EntireNetwork, SizeOf(EntireNetwork), 0);
18    with EntireNetwork do
19    begin
20      dwScope := 2;
21      dwDisplayType := 6;
22      dwUsage := 2;
23    end;
24  
25    WNetOpenEnum(RESOURCE_GLOBALNET,
26      RESOURCETYPE_ANY,
27      0,
28      @EntireNetwork,
29      EnumHandle);
30  
31    WorkgroupCount := 0;
32    repeat
33      Entries := 1;
34      BufSize := SizeOf(Buf);
35  
36      WNetEnumResource(EnumHandle,
37        Entries,
38        @Buf,
39        BufSize);
40      if Entries = 1 then
41      begin
42        Inc(WorkgroupCount);
43        Workgroup[WorkgroupCount] := StrPas(Buf[1].lpRemoteName);
44      end;
45    until (Entries <> 1);
46  
47    WNetCloseEnum(EnumHandle);
48  end;


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC