RegisterPowerSettingNotification

[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
public static extern IntPtr RegisterPowerSettingNotification(
   IntPtr hRecipient,
   ref Guid PowerSettingGuid,
   uint Flags
);

Microsoft documentation: Link

Last updated