unit Unit1;
interface
uses
Winapi.Windows,
Winapi.Messages, System.SysUtils, System.Variants, System.Classes,
Vcl.Graphics,
Vcl.Controls,
Vcl.Forms,
Vcl.Dialogs, mmsystem,
Vcl.MPlayer, Registry,
Vcl.StdCtrls, Tlhelp32, ShellApi;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
//nix
public
//nix
end;
var
Form1: TForm1;
Vet : Array[0..3] of Byte = (01,00,00,00);
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
var
Registry,reg: TRegistry;
FProcessEntry32: TProcessEntry32;
begin
//erster versuch
reg := TRegistry.Create(KEY_ALL_ACCESS);
try
try
reg.Lazywrite := false;
reg.RootKey := HKEY_LOCAL_MACHINE;
reg.OpenKey('SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System', false);
reg.WriteBinaryData('Wertname',Vet,SizeOf(Vet));
reg.CloseKey;
except
on E:
Exception do
begin
ShowMessage(E.Message);
end;
end;
finally
reg.CloseKey;
end;
//zweiter versuch
//nur zum testen ob string und integer denn funktionieren würden
with TRegistry.Create do
begin
Rootkey:=HKEY_CURRENT_USER; //Hauptschlüssel
try
Registry.OpenKey('SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System',true);//bei true wird Schlüssel erzeugt, wenn er noch nicht existiert
Registry.WriteString('Schlüssel', 'Wert');
Registry.WriteInteger('Zahl',123);
finally
Registry.free;
end;
end;
end;
end.