System Delphi

{ To automatically start a service after its installation use this code }
procedure TMyService.ServiceAfterInstall(Sender: TService);
var
sm: TServiceManager;
begin
sm := TServiceManager.Create;
try
if sm.Connect then
if sm.OpenServiceConnection(self.name) then
sm.StartService;
finally
sm.Free;
end;
end;