Jsou zobrazeny jen nové odpovědi. Zobrazit všechny
Předmět Autor Datum
procedure TForm1.Button1Click(Sender: TObject); var reg: TRegistry; I:Integer; begin ComboBox1.Text…
Jan Fiala 29.04.2019 18:48
Jan Fiala
Děkují moc ;-) poslední
Kocap 29.04.2019 19:30
Kocap
procedure TForm1.Button1Click(Sender: TObject);
var
 reg:  TRegistry;
 I:Integer;
begin
  ComboBox1.Text := '';
  Reg := TRegistry.Create;
  try
    Reg.Access := KEY_READ;
    Reg.RootKey := HKEY_LOCAL_MACHINE;
    if Reg.OpenKeyReadOnly('HARDWARE\DEVICEMAP\SERIALCOMM') then
    begin
      Reg.GetValueNames(ComboBox1.Items);
      for I := 0 to ComboBox1.Items.Count - 1 do
          ComboBox1.Items[i]:= Reg.ReadString(ComboBox1.Items[i]);
    end;
    ComboBox1.Sorted := true;
    if ComboBox1.Items.Count > 0 then
      ComboBox1.ItemIndex := 0;
  finally
    Reg.Free;
  end;
end;

Do HKEY_LOCAL_MACHINE nema program pristup na zapis, pouze pro cteni. Pokud to objektu TRegistry nereknes, nepusti te tam, to je radek:
Reg.Access := KEY_READ;

Zpět do poradny Odpovědět na původní otázku Nahoru