Reputation: 98
What is the most suitable? windows service to be implemented as a separate abstract class and reuse it when you need to create a service application or directly create a windows service outside of a class(C style) which is in the CodeProject.
Upvotes: 0
Views: 63
Reputation: 5069
Depends on your application: I wouldn't use the CodeProject example when you got to ensure that many modules are"loaded" before you "work" or if it's important to check from time to time that you really run, have to do critical or very complex work at shutdown et cetera et cetera... To sum up: If you have to interact often or complex with the service control environment, I would write a nice wrapper class (to be honest at the moment I mixed the C and C++ code, but I will refactor it).
Only if you write a "run forever until I kill you" I would write code like in your example.
Upvotes: 1