Articles   Members Online:
-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 get a list of all network adapters of a PC 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
30-Aug-02
Category
Win API
Language
Delphi 3.x
Views
127
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Tomas Rutkauskas 

How to get a list of all network adapters of a PC

Answer:

Example which can be used for all other hardware, too. Doesn't seem to work for Win 
2000 though.

1   uses
2     Registry;
3   
4   procedure GetNetworkAdapters(const List: TStrings);
5   var
6     R: TRegistry;
7     i: Integer;
8   begin
9     List.BeginUpdate;
10    try
11      R := TRegistry.Create;
12      try
13        R.RootKey := HKEY_DYN_DATA;
14        if R.OpenKeyReadOnly('\Config Manager\Enum') then
15        try
16          R.GetKeyNames(List);
17        finally
18          R.CloseKey;
19        end;
20        for i := List.Count - 1 downto 0 do
21          if (List[i] = '') or 
22  					not R.OpenKeyReadOnly('\Config Manager\Enum\' + List[i]) then
23            List.Delete(i)
24          else
25          try
26            List[i] := R.ReadString('HardwareKey');
27          finally
28            R.CloseKey;
29          end;
30        R.RootKey := HKEY_LOCAL_MACHINE;
31        for i := List.Count - 1 downto 0 do
32          if (List[i] = '') or not R.OpenKeyReadOnly('\Enum\' + List[i]) then
33            List.Delete(i)
34          else
35          try
36            if CompareText(R.ReadString('Class'), 'net') = 0 then
37              List[i] := R.ReadString('DeviceDesc')
38            else
39              List.Delete(i);
40          finally
41            R.CloseKey;
42          end;
43      finally
44        R.Free;
45      end;
46    finally
47      List.EndUpdate;
48    end;
49  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