IConsolePowerSink interface (mmc.h)

The IConsolePowerSink interface monitors and responds to power management messages.

Inheritance

The IConsolePowerSink interface inherits from the IUnknown interface. IConsolePowerSink also has these types of members:

Methods

The IConsolePowerSink interface has these methods.

 
IConsolePowerSink::OnPowerBroadcast

The OnPowerBroadcast method processes WM_POWERBROADCAST notification messages related to the computer's power management.

Remarks

To receive power management notifications, your snap-in must use the AtlAdvise function to associate an instance of the IConsolePower interface with your implementation of the IConsolePowerSink interface. The following code example shows how to use the AtlAdvise function.

Examples

// Connect the IConsolePower and IConsolePowerSink interfaces.
// m_ipConsolePower is a pointer to an instance of 
// the IConsolePower interface.
// m_ipConsolePowerSink is a pointer to an instance of 
// the IConsolePowerSink interface.
// m_dwCookie is of type DWORD.
hr = AtlAdvise(m_ipConsolePower,
               m_ipConsolePowerSink,
               IID_IConsolePowerSink,
               &m_dwCookie);

When your snap-in closes or no longer requires power management notifications, call the AtlUnadvise function to terminate the connection between the IConsolePower and IConsolePowerSink interfaces. The following code example shows how to use the AtlUnadvise function.

// Terminate the connection established previously.
hr = AtlUnadvise(m_ipConsolePower,
                 IID_IConsolePowerSink,
                 m_dwCookie);

Requirements

Requirement Value
Minimum supported client Windows Vista
Minimum supported server Windows Server 2008
Target Platform Windows
Header mmc.h

See also

IConsolePower