Einzelnen Beitrag anzeigen

espen

Registriert seit: 30. Aug 2003
Ort: Karlsruhe
17 Beiträge
 
#11

Re: Netzwerkkarten Info - inkl. Treiberinfo

  Alt 1. Okt 2009, 13:35
Hallo,

hier ein WMI-Ansatz. Ich habe mal Dieses Beispiel angepasst:

Delphi-Quellcode:
uses
  WbemScripting_TLB,
  ActiveX,
  OleServer;
...

procedure TForm1.Button1Click(Sender: TObject);
var
  aSrv : ISWbemServices;
  aObjSet : ISWbemObjectSet;
  vNVS : OleVariant;
  aNVSDummy : IDispatch;
  pEnum : IEnumVARIANT;
  vOut : OleVariant;
  dwRetrieved : LongWord;
  hRes : HResult;
begin
  aSrv := SWbemLocator1.ConnectServer('','','','','','',0,vNVS);
  aObjSet := aSrv.ExecQuery('SELECT * FROM Win32_Networkadapter', 'WQL', 0, aNVSDummy);
  pEnum := aObjSet.Get__NewEnum as IEnumVARIANT;
  while (TRUE) do
  begin
    hRes := pEnum.Next(1, vOut, dwRetrieved);
    if hRes <> S_OK then
    begin
      Break;
    end;
    ListBox1.Items.Add(VarToStr(vOut.Name));
  end;
end;
Ganz vergessen, hier noch die Properties:

Delphi-Quellcode:
class Win32_NetworkAdapter : CIM_NetworkAdapter
{
  string  AdapterType;
  uint16  AdapterTypeID;
  boolean  AutoSense;
  uint16  Availability;
  string  Caption;
  uint32  ConfigManagerErrorCode;
  boolean  ConfigManagerUserConfig;
  string  CreationClassName;
  string  Description;
  string  DeviceID;
  boolean  ErrorCleared;
  string  ErrorDescription;
  string  GUID;
  uint32  Index;
  datetime InstallDate;
  boolean  Installed;
  uint32  InterfaceIndex;
  uint32  LastErrorCode;
  string  MACAddress;
  string  Manufacturer;
  uint32  MaxNumberControlled;
  uint64  MaxSpeed;
  string  Name;
  string  NetConnectionID;
  uint16  NetConnectionStatus;
  boolean  NetEnabled;
  string  NetworkAddresses[];
  string  PermanentAddress;
  boolean  PhysicalAdapter;
  string  PNPDeviceID;
  uint16  PowerManagementCapabilities[];
  boolean  PowerManagementSupported;
  string  ProductName;
  string  ServiceName;
  uint64  Speed;
  string  Status;
  uint16  StatusInfo;
  string  SystemCreationClassName;
  string  SystemName;
  datetime TimeOfLastReset;
}
;
  Mit Zitat antworten Zitat