[Lazarus] Stopping a service from within a service

Jy V jyv110 at gmail.com
Thu Feb 4 23:53:17 CET 2016


On Thu, Feb 4, 2016 at 8:57 PM, Richard Mace <richard.mace at gmail.com> wrote:

> On 4 February 2016 at 17:39, Jy V <jyv110 at gmail.com> wrote:
>
>> On Thu, Feb 4, 2016 at 5:41 PM, Richard Mace <richard.mace at gmail.com>
>> wrote:
>> XMLRAD stop a program registered as a service running following code,
>>
>
> ​So, would I run this code by creating a TProcess from within my service,
> to get it to "stop" my service?
>

if you have the SvcHandle available inside your program since you are the
very own running service,
you can even skip OpenSCManagerA and OpenServiceA and stop the process
directly
calling ControlService(SvcHandle, SERVICE_CONTROL_STOP, Status)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20160204/ff809fd7/attachment-0003.html>


More information about the Lazarus mailing list