IConsolePowerSink

IConsolePowerSink interface

The IConsolePowerSink interface monitors and responds to power management messages.

When to implement

Implement the IConsolePowerSink interface to receive power management notifications.

When to use

Use the IConsolePowerSink interface when your snap-in requires power management notifications. Your implementation of the IConsolePowerSink interface will be invoked only on computers that support power management.

Members

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

Methods

The IConsolePowerSink interface has these methods.

MethodDescription
OnPowerBroadcast

Handles WM_POWERBROADCAST messages.

 

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

Minimum supported client

Windows Vista

Minimum supported server

Windows Server 2008

Header

Mmc.h

See also

IConsolePower

 

 

Show:
© 2016 Microsoft