I need to implement a Windows NT Service with Delphi as a part of my project. Before starting the implementation (program has been finished and is waiting only for this), due to the complexity of the task (and my reduced knowledge in "system things"), I would be very grateful to anyone who can give me an idea on the subject.
Before presenting my question, I will say a few words on the nature on the project: What I am writing in Delphi is a program that reads the NT Event Viewer logs and sends them somewhere else. Due to the automation of the thing, I have been asked to implement this as a Windows NT Service. I must underline that this service is NOT a Server of any kind (TCP, SMTP...). It will serve only as a Client - read the logs and send them. Thus (I think) I need no multi-treading, and I am happy for this because multi-threaded programming is a "big bone" for many, me included. I want to run this "routine" to some range between every 10 sec and 1 min. Under this conditions the task of reading NT Event Viewer records (from the last one send) will be normally short, few seconds, but in some cases it may be long (1 min or more) - when the service has stopped (or failed) for sometime and un-sent records have been accumulated. In this later case the operator will be instructed in documentation not to Stop the Service (at least no Terminate) until it finishes the current transport - this can be seen in some text debug file that is updated.
I have read many times almost all articles related on this site, especially the two below:
- "delphi service application stop after 15 second, timer not executing" thank you very much here for advising the non-usage of TTimer and also for the second article as
- "Tutorial for making a Service Application using Delphi" by Finn Tolderlund
Now exactly based into this article 2, my questions is:
Question: In my conditions - Can I go for the OnExecute solution?
I wish I could, as I (think!) I need no multi-threading; and it is much simpler in code.
best regards Altin