I have a Windows Forms application in C #, NET Framework 3.5 (in VS 2010), and I need that once installed the app, this (the app) starts when Windows returns from sleep mode (being the app fully closed and not running in the background), even when the user needs to enter his password (in this case, after the user logs).
You will need to have an application running to catch the event, however it doesn't have to be the full application - you can setup an application that all it does is respond to the event by opening your other app:
Microsoft.Win32.SystemEvents.PowerModeChanged += this.SystemEvents_PowerModeChanged;
private void SystemEvents_PowerModeChanged(object sender, Microsoft.Win32.PowerModeChangedEventArgs e)
{
if (e.Mode == PowerModes.Resume)
{
//Execute your "payload" app here.
}
}
Without a background service running, I don't think there's a built-in hook in Windows.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With