共用方式為


CWnd::OnPowerBroadcast

The framework calls this member function when a power-management event occurs.

afx_msg UINT OnPowerBroadcast(
    UINT nPowerEvent, 
    UINT nEventData
);

Parameters

Parameter

Description

[in] nPowerEvent

The power-management event.

[in] nEventData

Event-specific data.

Return Value

If the event is a request, return true to grant the request, or BROADCAST_QUERY_DENY to deny the request.

Remarks

This method receives the WM_POWERBROADCAST message, which is described in the Windows SDK.

The nPowerEvent parameter specifies events such as battery power is low, the power status has changed, permission to suspend operation is requested or denied, an operation is resuming automatically after an event, the system is suspending operation, or an operation is resuming after suspension. The nEventData parameter is typically not used. For more information, see the wParam and lParam parameters of the WM_POWERBROADCAST message.

注意

This member function is called by the framework to allow your application to handle a Windows message. The parameters passed to your function reflect the parameters received by the framework when the message was received. If you call the base-class implementation of this function, that implementation will use the parameters originally passed with the message and not the parameters you supply to the function.

Requirements

Header: afxwin.h

This method is supported in Windows Vista and later.

Additional requirements for this method are described in Build Requirements for Windows Vista Common Controls.

See Also

Reference

CWnd Class

Hierarchy Chart

WM_POWERBROADCAST

Concepts

CWnd Members