REASON_CONTEXT structure (minwinbase.h)

Contains information about a power request. This structure is used by the PowerCreateRequest and SetWaitableTimerEx functions.

Syntax

typedef struct _REASON_CONTEXT {
  ULONG Version;
  DWORD Flags;
  union {
    struct {
      HMODULE LocalizedReasonModule;
      ULONG   LocalizedReasonId;
      ULONG   ReasonStringCount;
      LPWSTR  *ReasonStrings;
    } Detailed;
    LPWSTR SimpleReasonString;
  } Reason;
} REASON_CONTEXT, *PREASON_CONTEXT;

Members

Version

The version number of the structure. This parameter must be set to POWER_REQUEST_CONTEXT_VERSION.

Flags

The format of the reason for the power request. This parameter can be one of the following values:

Value Meaning
POWER_REQUEST_CONTEXT_DETAILED_STRING
0x00000002
The Detailed structure identifies a localizable string resource that describes the reason for the power request.
POWER_REQUEST_CONTEXT_SIMPLE_STRING
0x00000001
The SimpleReasonString parameter contains a simple, non-localizable string that describes the reason for the power request.

Reason

A union that consists of either a Detailed structure or a string.

Reason.Detailed

A structure that identifies a localizable string resource to describe the reason for the power request.

Reason.Detailed.LocalizedReasonModule

The module that contains the string resource.

Reason.Detailed.LocalizedReasonId

The ID of the string resource.

Reason.Detailed.ReasonStringCount

The number of strings in the ReasonStrings parameter.

Reason.Detailed.ReasonStrings

An array of strings to be substituted in the string resource at run time.

Reason.SimpleReasonString

A non-localized string that describes the reason for the power request.

Remarks

It is safe to pass read-only strings as the SimpleReasonString or ReasonStrings because the PowerCreateRequest and SetWaitableTimerEx functions read from the strings and do not write to them.

Requirements

Requirement Value
Minimum supported client Windows 7 [desktop apps only]
Minimum supported server Windows Server 2008 R2 [desktop apps only]
Header minwinbase.h (include Windows.h)

See also

PowerCreateRequest

SetWaitableTimerEx