Is there a way to capture if Windows shutting down, or it is restarting? For shutdown, i found some solutions, but not for restart. For me it would be important to be able to determine if Windows is restarting, or just shutting down.
Thanks!
Is there a way to capture if Windows shutting down, or it is restarting? For shutdown, i found some solutions, but not for restart. For me it would be important to be able to determine if Windows is restarting, or just shutting down.
Thanks!
There is a way to detect whether it is shutting down and also there is a way to detect when it starts up.
So, you can note the time when it is shutting down. Note the time when it is starting by running an exe at startup (add your exe here in registry: HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce).
If the time difference is very less then you can treat it as a 'Restart'.
Also you can use WTSRegisterSessionNotification api for exact events.