I need to identify when the user locks up their Windows Operating System user, or the user goes into hibernation, or sleep, and takes action.
SystemEvents.PowerModeChanged += new PowerModeChangedEventHandler(OnPowerModeChanged);
private static void OnPowerModeChanged(object sender, PowerModeChangedEventArgs e) { switch (e.Mode) { case PowerModes.Resume: MessageBox.Show("PowerMode: OS is resuming from suspended state"); break; case PowerModes.Suspend: MessageBox.Show("PowerMode: OS is about to be suspended"); break; } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)