Hello,
if I install the RO based service as a windows service I have per default turned on “Allow service to interact with desktop”.
Is there a possibility to turn it off in the code? Does the RO SDK need this setting turned on?
Thank you for your help!
EvgenyK
(Evgeny Karpov)
August 17, 2017, 7:52am
2
what platform you are using - Delphi or .NET?
Delphi and RO SDK 9.3.0.1323
EvgenyK
(Evgeny Karpov)
August 17, 2017, 8:04am
4
I can’t reproduce this behavior with the Named Pipes sample.
service was created without “Allow service to interact with desktop” option:
I am using the IndyHttpServer and start the service as follow:
if ROStartService(AWindowsServiceName, AWindowsServiceName, WindowsServiceDesc) then
begin
MyIndyHttpServer.Start;
ROService.Run;
end;
Could you reproduce the issue with this code?
EvgenyK
(Evgeny Karpov)
August 17, 2017, 8:26am
6
yes, I can reproduce it with your code.
try to use code as in NamedPipeServer.dpr
:
uses
uROComInit,
SvcMgr,
...
Application.Initialize;
Application.Title := 'Named Pipes Server';
Application.CreateForm(TNamedPipeServerService, NamedPipeServerService);
Application.Run;
Great! I have re-coded my services and it works perfectly! Thx for the quick reply and help!
I have only the question how can I set the description for a service in the code? I don’t find any property for that.
EvgenyK
(Evgeny Karpov)
August 17, 2017, 2:44pm
8
from Service Application Tutorial in Delphi :
When you look at your service in the Services applet do you notice that the Description column is empty?
Unfortunately Delphi do not have a property in the TService class to set the description.
We have to set the description ourself after the Service Application has been installed.
Fortunately this is easy enough to do using the TRegistry class in the TService AfterInstall event.
The description is stored in the registry in the datavalue Description under the key
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\YourServiceName]
Try take a look there with the regedit application.
You set the Description datavalue like this:
procedure TMyTestServiceApp.ServiceAfterInstall(Sender: TService);
var
Reg: TRegistry;
begin
Reg := TRegistry.Create(KEY_READ or KEY_WRITE);
try
Reg.RootKey := HKEY_LOCAL_MACHINE;
if Reg.OpenKey('\SYSTEM\CurrentControlSet\Services\' + Name, false) then
begin
Reg.WriteString('Description', 'This is a description for my fine Service Application.');
Reg.CloseKey;
end;
finally
Reg.Free;
end;
end;