延迟睡眠或关机模式执行方法c#

时间:2014-10-21 06:29:49

标签: c# wpf

我正在使用这些系统通知来检测Windows的电源关闭或开机事件。现在我试图延迟断电事件并在此之前执行一个功能那么这怎么可能。

     [DllImport(@"User32", EntryPoint = "RegisterPowerSettingNotification",
          CallingConvention = CallingConvention.StdCall)]
     private static extern IntPtr RegisterPowerSettingNotification(
         IntPtr hRecipient,
         ref Guid PowerSettingGuid,
         Int32 Flags);

     [DllImport(@"User32", EntryPoint = "UnregisterPowerSettingNotification",
          CallingConvention = CallingConvention.StdCall)]
     private static extern bool UnregisterPowerSettingNotification(
         IntPtr handle);

0 个答案:

没有答案