this slowpoke moves

Mainboard Komponenten auslesen

uses Registry

procedure TForm1.FormCreate(Sender: TObject);

const
  RegConst   : array[boolean]of string = 
    ('Enum\PCI','SYSTEM\CurrentControlSet\Enum\PCI'); 
var 
  Reg        : TRegistry;
  RegEntries, 
  EntryList  : TStringList; 
  i, 
  j          : Integer; 
  S          : String; 
begin 
  Reg := TRegistry.Create(KEY_READ); 
  if Reg <> nil then 
  try 
    Reg.RootKey := HKEY_LOCAL_MACHINE; 

    RegEntries  := TStringList.Create; 
    EntryList   := TStringList.Create; 

    if(RegEntries <> nil) and (EntryList <> nil) then 
    try 
      if Reg.OpenKeyReadOnly(RegConst[Win32Platform = 
        VER_PLATFORM_WIN32_NT]) then 
      try 
        Reg.GetKeyNames(RegEntries); 
      finally 
        Reg.CloseKey; 
      end; 

      for i := 0 to RegEntries.Count - 1 do 
      begin 
        EntryList.Clear; 

        if Reg.OpenKeyReadOnly(RegConst[Win32Platform = 
          VER_PLATFORM_WIN32_NT] + '\' + RegEntries[i]) then 
        try 
          Reg.GetKeyNames(EntryList); 
        finally 
          Reg.CloseKey; 
        end; 

        for j := 0 to EntryList.Count - 1 do 
          if Reg.OpenKeyReadOnly(RegConst[Win32Platform = 
            VER_PLATFORM_WIN32_NT] + '\' + RegEntries[i] + 
            '\' + EntryList[j]) then 
          try 
            if Reg.ValueExists('FriendlyName') then 
              S := Reg.ReadString('FriendlyName') 
            else if Reg.ValueExists('DeviceDesc') then 
              S := Reg.ReadString('DeviceDesc') 
            else 
              S := ''; 

            if(S <> '') and 
              (ListBox1.Items.IndexOf(S) = -1) then 
            ListBox1.Items.Add(S); 
          finally 
            Reg.CloseKey; 
          end; 
      end; 
    finally 
      EntryList.Free; 
      RegEntries.Free; 
    end; 
  finally 
     Reg.Free; 
  end; 
end;

Keine Kommentare:

Kommentar veröffentlichen

Beliebte Posts

Translate