MENJALANKAN PROGRAM DI STARTUP

22.57
Anda ingin menjalankan program pada saat windows startup ? ini adalah source yang dapat membantu anda…

Uses Registry;

procedure SetAutoStart(AppName, AppTitle: string; register: boolean);
const
RegKey = '\Software\Microsoft\Windows\CurrentVersion\Run';
// or: RegKey = '\Software\Microsoft\Windows\CurrentVersion\RunOnce';
var
Registry: TRegistry;
begin
Registry := TRegistry.Create;
try
Registry.RootKey := HKEY_LOCAL_MACHINE;
if Registry.OpenKey(RegKey, False) then
begin
if register = false then
Registry.DeleteValue(AppTitle)
else
Registry.WriteString(AppTitle, AppName);
end;
finally
Registry.Free;
end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
SetAutoStart('Your Application Title',ParamStr(0),false);
end;

{
This was send in by Dennis K.N.
Fell free to use it
}

Artikel Terkait

Previous
Next Post »