|
|
|
| acAppAutoRun component.
|
| property OnAutoRun: TNotifyEvent;
|
| The OnAutoRun event occurs only when the program has been started on the Windows startup (after system reboot). If program started manually or by another program OnAutoRun will not occurs.
|
|
|
| On starting the application, acAppAutoRun component will check whether the '/autorun' argument are presented between the command line parameters. If the ParamStr(1) contains the '/autorun' line, the OnAutoRun occurs to inform the application about automatic starting on Windows startup
|
| procedure TForm1.acAppAutoRun1AutoRun(Sender: TObject);
|
| begin
|
| Application.ShowMainForm := False;
|
| acTrayIcon1.MinimizeToTray;
|
| end;
|
| { ...or, in case if you are using acAppEvents component to manage Application properties, you can write following handler for OnAutoRun event: }
|
| procedure TForm1.acAppAutoRun1AutoRun(Sender: TObject);
|
| begin
|
| acAppEvents1.ShowMainForm := False;
|
| acAppEvents1.ShowTaskIcon := False;
|
| acTrayIcon1.MinimizeToTray;
|
| end;
|
|
|
| program MyProgram;
|
|
|
| uses
|
| Forms,
|
| Main in 'Main.pas' {Form1};
|
|
|
| {$R *.RES}
|
|
|
| begin
|
| if ParamStr(1) = '/autorun' then
|
| begin
|
| // ... some operations
|
| end
|
| else
|
| begin
|
| Application.Initialize;
|
| Application.CreateForm(TForm1, Form1);
|
| Application.Run;
|
| end;
|
| end.
|
| AutoRun property.
|