Friday, June 22, 2012

IMMEDIATELY START A SERVICE AFTER ITS INSTALLATION

{ 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;

0 comments:

Post a Comment

 
Related Posts Plugin for WordPress, Blogger...