AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Win32/Win64 API (native code) Delphi Wie kann ich das Registry mit API lesen und schreiben?
Thema durchsuchen
Ansicht
Themen-Optionen

Wie kann ich das Registry mit API lesen und schreiben?

Ein Thema von TopDogg · begonnen am 28. Jun 2002 · letzter Beitrag vom 1. Jul 2002
 
Daniel B
(Gast)

n/a Beiträge
 
#7
  Alt 28. Jun 2002, 20:25
Hier ist mal meine Prozedur um Daten aus der Reg zu Lesen. Ich lade sie aber in eine Stringlist und weise sie dann der einen Combo zu. Du musst es halt noch anpassen. Vielleicht bringts dir ja was.

Code:
procedure TEinstellungen.FormShow(Sender: TObject);
//ComPorts ermitteln und in ComboBox Anzeigen
var
  reg: TRegistry;
  st: TStrings;
  i: integer;
  ini: TIniFile;
  s: string;
begin
  ShowMessage('Bei änderungen, kann gleich mit den neuen Werten weiter gearbeitet'
    + #13 + 'werden. Das Programm muss nicht neu gestartet werden!');
  reg := TRegistry.Create;
  reg.RootKey := HKEY_LOCAL_MACHINE;
  reg.OpenKey('hardware\devicemap\serialcomm', False);
  st := TStringList.Create;
  reg.GetValueNames(st);
  ComboBoxPort.Items.Clear;
  for i := 0 to st.Count -1 do
    begin
      ComboBoxPort.Items.Add(reg.ReadString(st.Strings[i]));
    end;
  st.Free;
  reg.CloseKey;
  reg.free;
  if MainFormMC2004.ComPort.Port = 'COM1' then
  begin
    ComboBoxPort.ItemIndex := 0;
  end
  else if MainFormMC2004.ComPort.Port = 'COM2' then
  begin
    ComboBoxPort.ItemIndex := 1;
  end
  else if MainFormMC2004.ComPort.Port = 'COM3' then
  begin
    ComboBoxPort.ItemIndex := 2;
  end
  else if MainFormMC2004.ComPort.Port = 'COM4' then
  begin
    ComboBoxPort.ItemIndex := 3;
  end
  else if MainFormMC2004.ComPort.Port = 'COM5' then
  begin
    ComboBoxPort.ItemIndex := 4;
  end
  else if MainFormMC2004.ComPort.Port = 'COM6' then
  begin
    ComboBoxPort.ItemIndex := 5;
  end
  else if MainFormMC2004.ComPort.Port = 'COM7' then
  begin
    ComboBoxPort.ItemIndex := 6;
  end
  else if MainFormMC2004.ComPort.Port = 'COM8' then
  begin
    ComboBoxPort.ItemIndex := 7;
  end;
  ini:=TIniFile.Create(ChangeFileExt(ParamStr(0), '.ini'));
  try
    s := ini.ReadString('Einstellungen', 'Baud', '');
  finally
    ini.Free;
  end;
  if s = '2400' then
  begin
    ComboBoxBaud.ItemIndex := 0;
  end
  else if s = '4800' then
  begin
    ComboBoxBaud.ItemIndex := 1;
  end
  else if s = '9600' then
  begin
    ComboBoxBaud.ItemIndex := 2;
  end
  else if s = '14400' then
  begin
    ComboBoxBaud.ItemIndex := 3;
  end
  else if s = '19200' then
  begin
    ComboBoxBaud.ItemIndex := 4;
  end
  else if s = '28800' then
  begin
    ComboBoxBaud.ItemIndex := 5;
  end
  else if s = '38400' then
  begin
    ComboBoxBaud.ItemIndex := 6;
  end;  
end;
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 01:20 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz