Correct way to register for pre-shutdown notification from C++
问题 I write a local service application using C++ and I can't find the correct way of registering for a pre-shut-down notification (for OS later than Windows XP). I believe that SERVICE_CONTROL_PRESHUTDOWN notification has been added since Vista, but when you call SetServiceStatus do we need to specify: dwServiceStatus.dwControlsAccepted = SERVICE_ACCEPT_PRESHUTDOWN; or dwServiceStatus.dwControlsAccepted = SERVICE_ACCEPT_SHUTDOWN | SERVICE_ACCEPT_PRESHUTDOWN; 回答1: You cannot accept both a