I have a windows service that in the OnStart it creates a thread and runs a
loop forever and ever, assuming the service is running. The loop stops
during the OnStop event, and everything works exactly as expected.
I also have an application that monitors that service using the
ServiceController component, and allows me to start & stop the service as
needed, as well as poll for it's current status. Still everything thus far
works and behaves as expected.
Now I want to add some functionality to the service monitoring application
to get actual useful information from the service, such as what is it
currently doing within the loop.
My idea (not sure if this is correct or not) was to create a new thread
that'll start in the service that will accept and send windows messages back
and forth between the monitoring application. The main processing loop,
everytime it's getting ready to do something would post it's current
activity/status to some variable somewhere that the other thread can pick up
and send (via SendMessage?) to the monitoring app...
Of course this is all hypothetical, assuming I can even do something like
this...
Ideas? Suggestions? Comments? Tips? Pointers??