[Lazarus] Win services
Michael Van Canneyt
michael at freepascal.org
Wed Dec 11 15:47:09 CET 2013
On Wed, 11 Dec 2013, Antonio Fortuny wrote:
>
> Le 11/12/2013 14:38, Michael Van Canneyt a écrit :
>>
>>
>> On Wed, 11 Dec 2013, Antonio Fortuny wrote:
>>
>>> Hi Folks.
>>>
>>> I'am in trouble when attempting to stop a Windows service using the
>>> TServiceManager component.
>>> The program runs into a Vista-32 box,
>>> the Lazarus IDE runs in an administrator user console: it has been started
>>> as d:...\Lazarus my_project.lpi
>>> When I run the program and do a step by step execution all looks good
>>> until the StopService line is reachad:
>>> The service name should be the display name, right ?
>>>
>>> SMgr := TServiceManager.Create(nil);
>>> try
>>> SMgr.Access := SC_MANAGER_ALL_ACCESS;
>>
>> You should set refreshonconnect:=true (or something similar).
> Ok Michael, works up to there (SMgr.Refresh works too)
> but when doing:
> h := SMgr.GetServiceHandle(SERVICE_NAME, SERVICE_ALL_ACCESS);
> I get the windows exception 1006 !!?
I don't know what that means.
Maybe you don't have permission to get a file handle on this service.
I use this component succesfully since many years in commercial code.
I would be very surprised to find out that it is an error in the code.
(but it is not excluded)
Michael.
More information about the Lazarus
mailing list