Hi there.
How do I make a TServiceApplication to act as an application?
The background:
I have an existing project, which I want to modiify to a service. The twist is that I want it to be an application if I start it with the parameter /Application (or similar).
I also want to configure the service by starting it with the parameter /Config.
The problem is the unit SvcMgr which has to be in the uses clause. This unit changes the Application object I think...?
I don't know how to explain my problem more than that.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
There is always another way to solve it, but I prefer my way.
How do I make a TServiceApplication to act as an application?
The background:
I have an existing project, which I want to modiify to a service. The twist is that I want it to be an application if I start it with the parameter /Application (or similar).
I also want to configure the service by starting it with the parameter /Config.
The problem is the unit SvcMgr which has to be in the uses clause. This unit changes the Application object I think...?
Code:
program ServiceApplication;
uses
Forms,
Dialogs,
SysUtils,
SvcMgr,
...
...
...
Unit1 in 'Unit1.pas' {MainForm};
{$R *.RES}
begin
Application.Initialize;
if SameText(ParamStr(1), '/CONFIG') then
begin
// Start config
Application.CreateForm(TConfigForm, ConfigForm);
end else
if SameText(ParamStr(1), '/APPLICATION') then
begin
// Start as application
Application.CreateForm(TMainForm, MainForm);
end else
// Start as service
Application.CreateForm(TRegenService, RegenService);
Application.Run;
end.
I don't know how to explain my problem more than that.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
There is always another way to solve it, but I prefer my way.