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