procedure TForm1.GetInfo;
const
RotKey:String='System/CurrentControlSet/Control/Class/{4d36e972-e325-11ce-bfc1-08002be10318}';
var
MyReg:TRegistry;
StrKeyName:TStringList;
StrTemp1,StrTemp2,StrTemp3:string;
i:integer;
begin
ComboBox1.Clear;
ComboBox2.Clear;
// 这里的代码适合WINDOWS2000,
//对于NT需要读取HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows NT/CurrentVersion/NetworkCards
MyReg:=TRegistry.Create;
StrKeyName:=TStringList.Create;
MyReg.RootKey:=HKEY_LOCAL_MACHINE;
MyReg.OpenKey(RotKey,False);
MyReg.GetKeyNames(StrKeyName);
for i:=0 to StrKeyName.Count-1 do
begin //DriverDesc
StrTemp1:=RotKey+'/'+StrKeyName.Strings+'/Ndi/Interfaces';// "ethernet" 判断是不是以太网卡
MyReg.CloseKey;
MyReg.OpenKey(StrTemp1,False);
StrTemp2:=MyReg.ReadString('LowerRange');
if StrTemp2='ethernet' then//判断是不是以太网卡
begin
StrTemp1:=RotKey+'/'+StrKeyName;
MyReg.CloseKey;
MyReg.OpenKey(StrTemp1,False);
StrTemp2:=MyReg.ReadString('DriverDesc');
ComboBox1.Items.Add(StrTemp2);
StrTemp3:=MyReg.ReadString('NetCfgInstanceId');
ComboBox2.Items.Add(StrTemp3);
//Showmessage(StrTemp2+#13+StrTemp3);
end;
end;
StrKeyName.Free;
MyReg.Free;
ComboBox1.ItemIndex:=0;
ComboBox2.ItemIndex:=0;
ComboBox1.OnChange(self);
ComboBox2.OnChange(self);
end;