I want to make service application in Delphi that run and copy some files everyday at 02:00 PM. So i have used timer. but control not going to timer event and Service termin
When you say "service terminates after 15 seconds" it makes me think you are debugging the code.
If you don't have any option and can't use what others suggested, with the code above the timer event is triggered properly when you install and start the service via services.msc. However, if you are debugging the service, the timer event will not be triggered and the aplication will terminate (as you said). I would create a procedure to be called inside timer event, and call it once in ServiceExecute event, so you could debug like this:
procedure TSomeService.ServiceExecute(Sender: TService);
begin
ExecuteSomeProcess(); // Put breakpoint here to debug
while not self.Terminated do
ServiceThread.ProcessRequests(true);
end;
procedure TSomeService.TimerTimer(Sender: TObject);
begin
timer.Enabled := false;
ExecuteSomeProcess(); // This can't throw any exception!
timer.Enabled := true;
end;