0

From the thread - Fire windows service stop event I know how to fire an event whenever a system service has stopped.

Now I want to fire an event when a service starts. But I can't find any service control code relating service starting. Is there anther way to implement it?

Any ideas will be appreciated.

Community
  • 1
  • 1
machinarium
  • 631
  • 6
  • 17

1 Answers1

0

Check out NotifyServiceStatusChange

Enables an application to receive notification when the specified service is created or deleted or when its status changes.

http://msdn.microsoft.com/en-us/library/windows/desktop/ms684276(v=vs.85).aspx

SERVICE_NOTIFY_START_PENDING (0x00000002) - Report when the service is starting. The hService parameter must be a handle to the service.

You could also use WMI:

How can I monitor status changes of windows services under windows xp?

Community
  • 1
  • 1
Andy Arismendi
  • 50,577
  • 16
  • 107
  • 124