Schlanker sieht's so aus:
Delphi-Quellcode:
procedure TForm1.Button2Click(Sender: TObject);
var Reg:TRegistry;
begin
Reg:=TRegistry.Create;
try
Reg.RootKey:=HKEY_CURRENT_USER; //bzw HKEY_LOCAL_MACHINE für alle User
if Reg.OpenKey('Software\Microsoft\Windows\CurrentVersion\Run',False) then
try
if not Reg.DeleteValue('GIS') then
Showmessage(SysErrorMessage(GetLastError));
finally
Reg.CloseKey;
end
else
Showmessage(SysErrorMessage(GetLastError));
finally
Reg.Free;
end;
end;
Ungetestet, müsste aber funktionieren.