PowerManager/PowerManager.h
author StephaneLenclud
Tue, 30 Aug 2016 16:50:37 +0200
changeset 260 d44943088c67
parent 159 e7c8c2b500bd
permissions -rw-r--r--
Adding user given name to EAR events and enabling User Events.
     1 // PowerManager.h
     2 
     3 #pragma once
     4 
     5 using namespace System;
     6 using namespace System::Windows::Forms;
     7 
     8 namespace PowerManager
     9 {
    10     public delegate void PowerManagerDelegate();
    11 
    12 	public ref class SettingNotifier
    13 	{
    14     public:
    15         //Constructors
    16         SettingNotifier(IntPtr aHandle, Boolean aService);
    17         SettingNotifier(IntPtr aHandle);
    18         //
    19         void WndProc(Message% aMessage);
    20 
    21         event PowerManagerDelegate^ OnMonitorPowerOn
    22         {
    23             void add(PowerManagerDelegate^ d);
    24             void remove(PowerManagerDelegate^ d);
    25         private:
    26             void raise();
    27         }
    28 
    29         event PowerManagerDelegate^ OnMonitorPowerOff
    30         {
    31             void add(PowerManagerDelegate^ d);
    32             void remove(PowerManagerDelegate^ d);
    33         private:
    34             void raise();
    35         }
    36 
    37     private:
    38         void Construct(IntPtr aHandle, Boolean aService);
    39         //
    40         HPOWERNOTIFY RegisterPowerSettingNotification(LPCGUID aGuid);
    41 
    42     private:
    43         PowerManagerDelegate^ iMonitorPowerOnDelegate;
    44         PowerManagerDelegate^ iMonitorPowerOffDelegate;
    45 
    46 
    47     private:
    48         /// Window or Service handle
    49         IntPtr iHandle;
    50         /// Specify whether we run as Window or a Service
    51         Boolean iIsService;
    52         ///
    53         int iMonitorPowerObserverCount;
    54         HPOWERNOTIFY iMonitorPowerHandle;
    55 	};
    56 }