Autor Beitrag
SuperDaniel
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 27



BeitragVerfasst: Mi 03.05.06 15:18 
hi, leute ich hab folgendes problem ich nutze diese funktion um eine zeichenefolge auszulesen was auch klappt, wenn dort jetzt aber keine zeichenfolge sondern ein dword ist kommt eine fehler meldung

ich brauch irgend ne möglich keit zuerkennen ob da ein dword oder eine zeichenfolge vorhanden ist, mit dem namen "Enabled", ich müsste nämlich beides auslesen können

wäre klasse wenn mir da einer helfen könnte


ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
procedure TForm1.Button1Click(Sender: TObject);
begin
  with TRegistry.Create do
  begin
    Rootkey:=HKEY_LOCAL_MACHINE;
  if OpenKey('Software\Microsoft\Windows Script Host\Settings\',false) = true then
  begin
aktiv:=Readstring('Enabled');
   end;
  Free;
  end;
end;
MarkH
Hält's aus hier
Beiträge: 1



BeitragVerfasst: Mi 03.05.06 15:31 
Schau dir mal die Funktion

ausblenden Quelltext
1:
GetDataInfo(const ValueName: String; var Value: TRegDataInfo): Boolean;					


von TRegistry an

Gruß

Mark
SuperDaniel Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 27



BeitragVerfasst: Mi 03.05.06 15:50 
danke
SuperDaniel Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 27



BeitragVerfasst: Mi 03.05.06 16:29 
danke habs jetzt so gemacht

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
procedure TForm1.Button1Click(Sender: TObject);
var
  reg: TRegistry;
  DataType: TRegDataType;
  DataInfo: TRegDataInfo;
begin
reg := TRegistry.Create;
  try
  reg.Rootkey:=HKEY_LOCAL_MACHINE;
    if reg.OpenKeyReadOnly('SOFTWARE\Microsoft\Windows Script Host\Settings\')= true then
    begin
      if reg.ValueExists('enabled'then
      begin
      DataType := reg.GetDataType('enabled');
      case DataType of
          rdString, rdExpandString: begin
          aktivstring := reg.ReadString('enabled');
          end;
          rdInteger: begin
          aktivdword := IntToStr(reg.ReadInteger('enabled'));
          end;end;end;end;
  finally
    reg.Free;
  end;
end;