More than one service using same application

Posted by Elena on May 11, 2010

Hello,

I need to create a service application which can be started X times as a service.
I used the following code:
procedure TMyService.ServiceBeforeInstall(Sender: TService);
begin
if ParamStr(1)='-install' then IHotel := ParamStr(2) else IHotel :=
ParamStr(1);
IHotel := TRIM(AnsiReplaceText(Copy(IHotel,2), ' ', ''));
if Length(IHotel) = 0 then
begin
Showmessage('Hotel name not specified.' + #13 + 'Service can not be
installed');
Abort;
end;

DisplayName := 'Opera IFC8 AliveCheck for ' + IHotel;
Name := 'MyServiceAliveCheckfor' + IHotel;
end;

Problem is that service freeze on startup when I change service name with last line of the above procedure. If I comment last line service works perfectly but then I can install only one service as the second one will have same name then the first one.

Is there anyone who can help please?

Regards
Elena

Related articles

       

Follow Ups

Post a Followup

Name:
Password:

Subject:

Comments:

DelphiLand Club members: enter your Membership password.
Guests can get a Forum Guest password by subscribing to the DelphiLand Newsletter.