TryRunAsService Method
Runs ABody as a Windows service, blocking until it returns.
Remarks
AServiceName is the name the service was registered under; when empty, the executable base name is used.
Returns False without running anything when the process was not started by the SCM, which is how the host falls back to console mode.
ABody runs on the thread the SCM creates for ServiceMain, not on the main thread -- the main thread is parked inside the dispatcher for as long as the service lives. An exception escaping the body is captured, reported to the SCM as a service specific error, and re-raised to the caller once the dispatcher returns.
Syntax
Unit: Sparkle.Host.WinService
function TryRunAsService(const AServiceName: string; const ABody: TServiceBody): Boolean;
Parameters
| <-> | Parameter | Type | Description |
|---|---|---|---|
| const | AServiceName | string | |
| const | ABody | TServiceBody |