Einzelnen Beitrag anzeigen

Benutzerbild von malo
malo

Registriert seit: 19. Sep 2004
2.115 Beiträge
 
#7

Re: How to write in registry hex key?

  Alt 19. Nov 2005, 21:58
btw, that code is better:

Delphi-Quellcode:
program Test;

{$APPTYPE CONSOLE}

uses
  SysUtils,
  Registry,
  Windows;

var
  Reg : TRegistry;
  buf: array[0..3] of byte;

begin
  buf[0] := $01;
  buf[1] := $00;
  buf[2] := $00;
  buf[3] := $00;

  try // try-finally needed. If there is an exception anywhere, the object maybe does not free.
    Reg:=TRegistry.Create;
    Reg.RootKey:=HKEY_LOCAL_MACHINE;
    Reg.OpenKey('SYSTEM', False);
    Reg.CreateKey('Parameters');
    Reg.OpenKey('Parameters', False);
    Reg.WriteBinaryData('Test', buf, 4); // hier was the error. You don't need to put a pointer here
    Reg.CloseKey;
  finally // now free the object
    Reg.Free;
  end;
end.
  Mit Zitat antworten Zitat