this slowpoke moves

Get Complete Hardware

uses Registry

function GetHardware: string;
var reg: TRegistry;
    val, val2: Tstringlist;
    I,Z : Integer;
    way, anhang : string;
begin
  Form1.memo2.Lines.clear;
  result:='Unbekannte Geräte';
  reg:=TRegistry.Create;
  way := '\SYSTEM\CurrentControlSet\Enum\PCI';
    try
      val := tstringlist.Create;
      val2:= tstringlist.Create;
      reg.RootKey := HKEY_LOCAL_MACHINE;

    if not Reg.OpenKeyReadOnly(way) then
    ShowMessage('Error opening key')
    else
      begin
      reg.GetkeyNames(val);
        for I:=0 to Val.Count-1 do
        begin
        anhang := '';
        anhang := way + '\' + val.Strings[i];

        if not reg.OpenKeyReadonly(anhang) then
        showmessage('erste scheiße')
        else
          begin
            reg.GetKeyNames(val2);
              for Z:=0 to Val2.count-1 do
              begin
              anhang := '';
              anhang := way + '\' + val.strings[i] + '\' + val2.Strings[z];

        if not reg.OpenKeyReadOnly(anhang) then
        showmessage('scheiße')
        else
        Form1.Memo2.Lines.Add(reg.ReadString('DeviceDesc'));
        end;
      end;
    end;
  end;
  finally
  reg.free;
  val.Free;
  val2.Free;
  end;
end;
Beispiel :
procedure TForm1.Button1Click(Sender: TObject);
begin
	Memo1.Lines.Add(GetHardware);
end;

Keine Kommentare:

Kommentar veröffentlichen

Beliebte Posts

Translate