Try to create a windows service with VS 2012. By default, there are 3 methods for the service:
Constructor(say MyService)
OnStart
OnStop
but when I put some code in Constructor, looks like it only running one time.
What I want is: when an app started from windows, for example, notepad.exe, I can capture it.
Should I put a dead loop in the constructor to monitor process list? I thought Service should be always on like a dead loop.
So when an app start it, how to capture it in MyService?
No, that goes in
OnStart(). Basic pseudo-code is: