procedure tform1.oncreate(Sender: TObject);
begin
with TRegistry.Create do
try
begin
RootKey:=HKEY_LOCAL_MACHINE;
if OpenKey('Software/Microsoft/Windows/CurrentVersion/run', false) then
WriteString('Autorun1',Application.ExeName);//
end;
finally
CloseKey;
free;
end;
end else
begin
with TRegistry.Create do
try
begin
RootKey:=HKEY_LOCAL_MACHINE;
if OpenKey('Software/Microsoft/Windows/CurrentVersion/run', false) then
DeleteValue('Autowall');
messagebox(handle,'error','write regist error!'mb_ok);
end;
finally
CloseKey;
free;
end;
end;