TROService
is descendant of std TService
so you can use solution from Service Application Tutorial in Delphi :
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;
have you tried to use ParamStr(0)
? it should return executable name from which you can easily get executable path