This guide will cover certain ways to detect restart or shutdown of the PC, as well as other similar events, such as log off or sleep. We will be handling the OS shutdown event using WinAPI for different types of applications - console, GUI applications, and services. If you’re interested in the general information on Windows process monitoring, you can also check out this article.
Written by:
Tatyana Zakatova,
Software Developer of Apriorit
Why do we need to detect computer shutdown?
Computer shutdown detection is required to complete short, but very important actions, such as:
- Saving all unsaved data
- Notify distributed system components via network that the current component will be shut off
- Add record about the shutdown into the log in order to better analyze the situation
Full article: https://www.apriorit.com/dev-blog/413-win-api-shutdown-events