I created windows service in delphi. My code runs in ServiceExecute
procedure TMyService.ServiceExecute(Sender: TService); while not Terminated do begin CallSomeProcedure; Sleep(1000); ServiceThread.ProcessRequests(false); end; end;
Sorry, I cannot run this code. I don't seem to call this procedure even when I am debugging. The code in Myservice.exe is as follows.
begin if not Application.DelayInitialize or Application.Installing then Application.Initialize; Application.CreateForm(TMyService, MyService); Application.Run; end.
I can run serviceExecute if I add
MyService.ServiceExecute(nil);
in MyService.exe, however, if I install it as a service, it does not seem to work as Application.Run does anything
Not sure what I'm doing wrong, but any help would be greatly appreciated.
thanks
source share