Win32 API 日本語リファレンス
ホームSystem.Power › SYSTEM_POWER_POLICY

SYSTEM_POWER_POLICY

構造体
サイズx64: 232 バイト / x86: 232 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
RevisionDWORD4+0+0このポリシー構造体のリビジョン番号。
PowerButtonPOWER_ACTION_POLICY12+4+4電源ボタン押下時の電源アクションポリシー。
SleepButtonPOWER_ACTION_POLICY12+16+16スリープボタン押下時の電源アクションポリシー。
LidClosePOWER_ACTION_POLICY12+28+28ノートPCの蓋を閉じた時の電源アクションポリシー。
LidOpenWakeSYSTEM_POWER_STATE4+40+40蓋を開いた際に復帰するシステム電源状態。
ReservedDWORD4+44+44将来の拡張用に予約された領域。
IdlePOWER_ACTION_POLICY12+48+48アイドル検出時に実行する電源アクションポリシー。
IdleTimeoutDWORD4+60+60アイドルアクション発動までのタイムアウト時間。秒単位。
IdleSensitivityBYTE1+64+64アイドル判定の感度。パーセントで表す。
DynamicThrottleBYTE1+65+65動的スロットリングのポリシーを示す値。
Spare2BYTE2+66+66アライメント用の予備バイト。
MinSleepSYSTEM_POWER_STATE4+68+68許可される最小スリープ状態。
MaxSleepSYSTEM_POWER_STATE4+72+72許可される最大スリープ状態。
ReducedLatencySleepSYSTEM_POWER_STATE4+76+76低遅延復帰用のスリープ状態。
WinLogonFlagsDWORD4+80+80Winlogon関連の動作を制御するフラグのビット集合。
Spare3DWORD4+84+84アライメント用の予備領域。
DozeS4TimeoutDWORD4+88+88S4(休止)へ移行するまでのドーズタイムアウト。秒単位。
BroadcastCapacityResolutionDWORD4+92+92バッテリ残量変化を通知する分解能。パーセント。
DischargePolicySYSTEM_POWER_LEVEL96+96+96バッテリ放電レベルごとのアクションポリシー配列。
VideoTimeoutDWORD4+192+192ディスプレイをオフにするまでのタイムアウト。秒単位。
VideoDimDisplayBOOLEAN1+196+196ディスプレイの輝度を下げるかどうかを示すブール値。
VideoReservedDWORD12+200+200ビデオ関連の予約領域。
SpindownTimeoutDWORD4+212+212ハードディスクを停止するまでのタイムアウト。秒単位。
OptimizeForPowerBOOLEAN1+216+216省電力を優先するかどうかを示すブール値。
FanThrottleToleranceBYTE1+217+217ファン制御のスロットリング許容度。パーセントで表す。
ForcedThrottleBYTE1+218+218強制的に適用するスロットリング量。パーセントで表す。
MinThrottleBYTE1+219+219許可される最小スロットリング量。パーセントで表す。
OverThrottledPOWER_ACTION_POLICY12+220+220過剰スロットリング時に実行する電源アクションポリシー。

各言語での定義

#include <windows.h>

// POWER_ACTION_POLICY  (x64 12 / x86 12 バイト)
typedef struct POWER_ACTION_POLICY {
    POWER_ACTION Action;
    DWORD Flags;
    POWER_ACTION_POLICY_EVENT_CODE EventCode;
} POWER_ACTION_POLICY;

// SYSTEM_POWER_LEVEL  (x64 24 / x86 24 バイト)
typedef struct SYSTEM_POWER_LEVEL {
    BOOLEAN Enable;
    BYTE Spare[3];
    DWORD BatteryLevel;
    POWER_ACTION_POLICY PowerPolicy;
    SYSTEM_POWER_STATE MinSystemState;
} SYSTEM_POWER_LEVEL;

// SYSTEM_POWER_POLICY  (x64 232 / x86 232 バイト)
typedef struct SYSTEM_POWER_POLICY {
    DWORD Revision;
    POWER_ACTION_POLICY PowerButton;
    POWER_ACTION_POLICY SleepButton;
    POWER_ACTION_POLICY LidClose;
    SYSTEM_POWER_STATE LidOpenWake;
    DWORD Reserved;
    POWER_ACTION_POLICY Idle;
    DWORD IdleTimeout;
    BYTE IdleSensitivity;
    BYTE DynamicThrottle;
    BYTE Spare2[2];
    SYSTEM_POWER_STATE MinSleep;
    SYSTEM_POWER_STATE MaxSleep;
    SYSTEM_POWER_STATE ReducedLatencySleep;
    DWORD WinLogonFlags;
    DWORD Spare3;
    DWORD DozeS4Timeout;
    DWORD BroadcastCapacityResolution;
    SYSTEM_POWER_LEVEL DischargePolicy[4];
    DWORD VideoTimeout;
    BOOLEAN VideoDimDisplay;
    DWORD VideoReserved[3];
    DWORD SpindownTimeout;
    BOOLEAN OptimizeForPower;
    BYTE FanThrottleTolerance;
    BYTE ForcedThrottle;
    BYTE MinThrottle;
    POWER_ACTION_POLICY OverThrottled;
} SYSTEM_POWER_POLICY;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct POWER_ACTION_POLICY
{
    public int Action;
    public uint Flags;
    public uint EventCode;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SYSTEM_POWER_LEVEL
{
    [MarshalAs(UnmanagedType.U1)] public bool Enable;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] Spare;
    public uint BatteryLevel;
    public POWER_ACTION_POLICY PowerPolicy;
    public int MinSystemState;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SYSTEM_POWER_POLICY
{
    public uint Revision;
    public POWER_ACTION_POLICY PowerButton;
    public POWER_ACTION_POLICY SleepButton;
    public POWER_ACTION_POLICY LidClose;
    public int LidOpenWake;
    public uint Reserved;
    public POWER_ACTION_POLICY Idle;
    public uint IdleTimeout;
    public byte IdleSensitivity;
    public byte DynamicThrottle;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] Spare2;
    public int MinSleep;
    public int MaxSleep;
    public int ReducedLatencySleep;
    public uint WinLogonFlags;
    public uint Spare3;
    public uint DozeS4Timeout;
    public uint BroadcastCapacityResolution;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public SYSTEM_POWER_LEVEL[] DischargePolicy;
    public uint VideoTimeout;
    [MarshalAs(UnmanagedType.U1)] public bool VideoDimDisplay;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public uint[] VideoReserved;
    public uint SpindownTimeout;
    [MarshalAs(UnmanagedType.U1)] public bool OptimizeForPower;
    public byte FanThrottleTolerance;
    public byte ForcedThrottle;
    public byte MinThrottle;
    public POWER_ACTION_POLICY OverThrottled;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure POWER_ACTION_POLICY
    Public Action As Integer
    Public Flags As UInteger
    Public EventCode As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SYSTEM_POWER_LEVEL
    <MarshalAs(UnmanagedType.U1)> Public Enable As Boolean
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=3)> Public Spare() As Byte
    Public BatteryLevel As UInteger
    Public PowerPolicy As POWER_ACTION_POLICY
    Public MinSystemState As Integer
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SYSTEM_POWER_POLICY
    Public Revision As UInteger
    Public PowerButton As POWER_ACTION_POLICY
    Public SleepButton As POWER_ACTION_POLICY
    Public LidClose As POWER_ACTION_POLICY
    Public LidOpenWake As Integer
    Public Reserved As UInteger
    Public Idle As POWER_ACTION_POLICY
    Public IdleTimeout As UInteger
    Public IdleSensitivity As Byte
    Public DynamicThrottle As Byte
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=2)> Public Spare2() As Byte
    Public MinSleep As Integer
    Public MaxSleep As Integer
    Public ReducedLatencySleep As Integer
    Public WinLogonFlags As UInteger
    Public Spare3 As UInteger
    Public DozeS4Timeout As UInteger
    Public BroadcastCapacityResolution As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=4)> Public DischargePolicy() As SYSTEM_POWER_LEVEL
    Public VideoTimeout As UInteger
    <MarshalAs(UnmanagedType.U1)> Public VideoDimDisplay As Boolean
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=3)> Public VideoReserved() As UInteger
    Public SpindownTimeout As UInteger
    <MarshalAs(UnmanagedType.U1)> Public OptimizeForPower As Boolean
    Public FanThrottleTolerance As Byte
    Public ForcedThrottle As Byte
    Public MinThrottle As Byte
    Public OverThrottled As POWER_ACTION_POLICY
End Structure
import ctypes
from ctypes import wintypes

class POWER_ACTION_POLICY(ctypes.Structure):
    _fields_ = [
        ("Action", ctypes.c_int),
        ("Flags", wintypes.DWORD),
        ("EventCode", wintypes.DWORD),
    ]

class SYSTEM_POWER_LEVEL(ctypes.Structure):
    _fields_ = [
        ("Enable", ctypes.c_byte),
        ("Spare", ctypes.c_ubyte * 3),
        ("BatteryLevel", wintypes.DWORD),
        ("PowerPolicy", POWER_ACTION_POLICY),
        ("MinSystemState", ctypes.c_int),
    ]

class SYSTEM_POWER_POLICY(ctypes.Structure):
    _fields_ = [
        ("Revision", wintypes.DWORD),
        ("PowerButton", POWER_ACTION_POLICY),
        ("SleepButton", POWER_ACTION_POLICY),
        ("LidClose", POWER_ACTION_POLICY),
        ("LidOpenWake", ctypes.c_int),
        ("Reserved", wintypes.DWORD),
        ("Idle", POWER_ACTION_POLICY),
        ("IdleTimeout", wintypes.DWORD),
        ("IdleSensitivity", ctypes.c_ubyte),
        ("DynamicThrottle", ctypes.c_ubyte),
        ("Spare2", ctypes.c_ubyte * 2),
        ("MinSleep", ctypes.c_int),
        ("MaxSleep", ctypes.c_int),
        ("ReducedLatencySleep", ctypes.c_int),
        ("WinLogonFlags", wintypes.DWORD),
        ("Spare3", wintypes.DWORD),
        ("DozeS4Timeout", wintypes.DWORD),
        ("BroadcastCapacityResolution", wintypes.DWORD),
        ("DischargePolicy", SYSTEM_POWER_LEVEL * 4),
        ("VideoTimeout", wintypes.DWORD),
        ("VideoDimDisplay", ctypes.c_byte),
        ("VideoReserved", wintypes.DWORD * 3),
        ("SpindownTimeout", wintypes.DWORD),
        ("OptimizeForPower", ctypes.c_byte),
        ("FanThrottleTolerance", ctypes.c_ubyte),
        ("ForcedThrottle", ctypes.c_ubyte),
        ("MinThrottle", ctypes.c_ubyte),
        ("OverThrottled", POWER_ACTION_POLICY),
    ]
#[repr(C)]
pub struct POWER_ACTION_POLICY {
    pub Action: i32,
    pub Flags: u32,
    pub EventCode: u32,
}

#[repr(C)]
pub struct SYSTEM_POWER_LEVEL {
    pub Enable: u8,
    pub Spare: [u8; 3],
    pub BatteryLevel: u32,
    pub PowerPolicy: POWER_ACTION_POLICY,
    pub MinSystemState: i32,
}

#[repr(C)]
pub struct SYSTEM_POWER_POLICY {
    pub Revision: u32,
    pub PowerButton: POWER_ACTION_POLICY,
    pub SleepButton: POWER_ACTION_POLICY,
    pub LidClose: POWER_ACTION_POLICY,
    pub LidOpenWake: i32,
    pub Reserved: u32,
    pub Idle: POWER_ACTION_POLICY,
    pub IdleTimeout: u32,
    pub IdleSensitivity: u8,
    pub DynamicThrottle: u8,
    pub Spare2: [u8; 2],
    pub MinSleep: i32,
    pub MaxSleep: i32,
    pub ReducedLatencySleep: i32,
    pub WinLogonFlags: u32,
    pub Spare3: u32,
    pub DozeS4Timeout: u32,
    pub BroadcastCapacityResolution: u32,
    pub DischargePolicy: [SYSTEM_POWER_LEVEL; 4],
    pub VideoTimeout: u32,
    pub VideoDimDisplay: u8,
    pub VideoReserved: [u32; 3],
    pub SpindownTimeout: u32,
    pub OptimizeForPower: u8,
    pub FanThrottleTolerance: u8,
    pub ForcedThrottle: u8,
    pub MinThrottle: u8,
    pub OverThrottled: POWER_ACTION_POLICY,
}
import "golang.org/x/sys/windows"

type POWER_ACTION_POLICY struct {
	Action int32
	Flags uint32
	EventCode uint32
}

type SYSTEM_POWER_LEVEL struct {
	Enable byte
	Spare [3]byte
	BatteryLevel uint32
	PowerPolicy POWER_ACTION_POLICY
	MinSystemState int32
}

type SYSTEM_POWER_POLICY struct {
	Revision uint32
	PowerButton POWER_ACTION_POLICY
	SleepButton POWER_ACTION_POLICY
	LidClose POWER_ACTION_POLICY
	LidOpenWake int32
	Reserved uint32
	Idle POWER_ACTION_POLICY
	IdleTimeout uint32
	IdleSensitivity byte
	DynamicThrottle byte
	Spare2 [2]byte
	MinSleep int32
	MaxSleep int32
	ReducedLatencySleep int32
	WinLogonFlags uint32
	Spare3 uint32
	DozeS4Timeout uint32
	BroadcastCapacityResolution uint32
	DischargePolicy [4]SYSTEM_POWER_LEVEL
	VideoTimeout uint32
	VideoDimDisplay byte
	VideoReserved [3]uint32
	SpindownTimeout uint32
	OptimizeForPower byte
	FanThrottleTolerance byte
	ForcedThrottle byte
	MinThrottle byte
	OverThrottled POWER_ACTION_POLICY
}
type
  POWER_ACTION_POLICY = record
    Action: Integer;
    Flags: DWORD;
    EventCode: DWORD;
  end;

  SYSTEM_POWER_LEVEL = record
    Enable: ByteBool;
    Spare: array[0..2] of Byte;
    BatteryLevel: DWORD;
    PowerPolicy: POWER_ACTION_POLICY;
    MinSystemState: Integer;
  end;

  SYSTEM_POWER_POLICY = record
    Revision: DWORD;
    PowerButton: POWER_ACTION_POLICY;
    SleepButton: POWER_ACTION_POLICY;
    LidClose: POWER_ACTION_POLICY;
    LidOpenWake: Integer;
    Reserved: DWORD;
    Idle: POWER_ACTION_POLICY;
    IdleTimeout: DWORD;
    IdleSensitivity: Byte;
    DynamicThrottle: Byte;
    Spare2: array[0..1] of Byte;
    MinSleep: Integer;
    MaxSleep: Integer;
    ReducedLatencySleep: Integer;
    WinLogonFlags: DWORD;
    Spare3: DWORD;
    DozeS4Timeout: DWORD;
    BroadcastCapacityResolution: DWORD;
    DischargePolicy: array[0..3] of SYSTEM_POWER_LEVEL;
    VideoTimeout: DWORD;
    VideoDimDisplay: ByteBool;
    VideoReserved: array[0..2] of DWORD;
    SpindownTimeout: DWORD;
    OptimizeForPower: ByteBool;
    FanThrottleTolerance: Byte;
    ForcedThrottle: Byte;
    MinThrottle: Byte;
    OverThrottled: POWER_ACTION_POLICY;
  end;
const POWER_ACTION_POLICY = extern struct {
    Action: i32,
    Flags: u32,
    EventCode: u32,
};

const SYSTEM_POWER_LEVEL = extern struct {
    Enable: u8,
    Spare: [3]u8,
    BatteryLevel: u32,
    PowerPolicy: POWER_ACTION_POLICY,
    MinSystemState: i32,
};

const SYSTEM_POWER_POLICY = extern struct {
    Revision: u32,
    PowerButton: POWER_ACTION_POLICY,
    SleepButton: POWER_ACTION_POLICY,
    LidClose: POWER_ACTION_POLICY,
    LidOpenWake: i32,
    Reserved: u32,
    Idle: POWER_ACTION_POLICY,
    IdleTimeout: u32,
    IdleSensitivity: u8,
    DynamicThrottle: u8,
    Spare2: [2]u8,
    MinSleep: i32,
    MaxSleep: i32,
    ReducedLatencySleep: i32,
    WinLogonFlags: u32,
    Spare3: u32,
    DozeS4Timeout: u32,
    BroadcastCapacityResolution: u32,
    DischargePolicy: [4]SYSTEM_POWER_LEVEL,
    VideoTimeout: u32,
    VideoDimDisplay: u8,
    VideoReserved: [3]u32,
    SpindownTimeout: u32,
    OptimizeForPower: u8,
    FanThrottleTolerance: u8,
    ForcedThrottle: u8,
    MinThrottle: u8,
    OverThrottled: POWER_ACTION_POLICY,
};
type
  POWER_ACTION_POLICY {.bycopy.} = object
    Action: int32
    Flags: uint32
    EventCode: uint32

  SYSTEM_POWER_LEVEL {.bycopy.} = object
    Enable: uint8
    Spare: array[3, uint8]
    BatteryLevel: uint32
    PowerPolicy: POWER_ACTION_POLICY
    MinSystemState: int32

  SYSTEM_POWER_POLICY {.bycopy.} = object
    Revision: uint32
    PowerButton: POWER_ACTION_POLICY
    SleepButton: POWER_ACTION_POLICY
    LidClose: POWER_ACTION_POLICY
    LidOpenWake: int32
    Reserved: uint32
    Idle: POWER_ACTION_POLICY
    IdleTimeout: uint32
    IdleSensitivity: uint8
    DynamicThrottle: uint8
    Spare2: array[2, uint8]
    MinSleep: int32
    MaxSleep: int32
    ReducedLatencySleep: int32
    WinLogonFlags: uint32
    Spare3: uint32
    DozeS4Timeout: uint32
    BroadcastCapacityResolution: uint32
    DischargePolicy: array[4, SYSTEM_POWER_LEVEL]
    VideoTimeout: uint32
    VideoDimDisplay: uint8
    VideoReserved: array[3, uint32]
    SpindownTimeout: uint32
    OptimizeForPower: uint8
    FanThrottleTolerance: uint8
    ForcedThrottle: uint8
    MinThrottle: uint8
    OverThrottled: POWER_ACTION_POLICY
struct POWER_ACTION_POLICY
{
    int Action;
    uint Flags;
    uint EventCode;
}

struct SYSTEM_POWER_LEVEL
{
    ubyte Enable;
    ubyte[3] Spare;
    uint BatteryLevel;
    POWER_ACTION_POLICY PowerPolicy;
    int MinSystemState;
}

struct SYSTEM_POWER_POLICY
{
    uint Revision;
    POWER_ACTION_POLICY PowerButton;
    POWER_ACTION_POLICY SleepButton;
    POWER_ACTION_POLICY LidClose;
    int LidOpenWake;
    uint Reserved;
    POWER_ACTION_POLICY Idle;
    uint IdleTimeout;
    ubyte IdleSensitivity;
    ubyte DynamicThrottle;
    ubyte[2] Spare2;
    int MinSleep;
    int MaxSleep;
    int ReducedLatencySleep;
    uint WinLogonFlags;
    uint Spare3;
    uint DozeS4Timeout;
    uint BroadcastCapacityResolution;
    SYSTEM_POWER_LEVEL[4] DischargePolicy;
    uint VideoTimeout;
    ubyte VideoDimDisplay;
    uint[3] VideoReserved;
    uint SpindownTimeout;
    ubyte OptimizeForPower;
    ubyte FanThrottleTolerance;
    ubyte ForcedThrottle;
    ubyte MinThrottle;
    POWER_ACTION_POLICY OverThrottled;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SYSTEM_POWER_POLICY サイズ: 232 バイト(x64)
dim st, 58    ; 4byte整数×58(構造体サイズ 232 / 4 切り上げ)
; Revision : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; PowerButton : POWER_ACTION_POLICY (+4, 12byte)  varptr(st)+4 を基点に操作(12byte:入れ子/配列)
; SleepButton : POWER_ACTION_POLICY (+16, 12byte)  varptr(st)+16 を基点に操作(12byte:入れ子/配列)
; LidClose : POWER_ACTION_POLICY (+28, 12byte)  varptr(st)+28 を基点に操作(12byte:入れ子/配列)
; LidOpenWake : SYSTEM_POWER_STATE (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; Reserved : DWORD (+44, 4byte)  st.11 = 値  /  値 = st.11   (lpoke/lpeek も可)
; Idle : POWER_ACTION_POLICY (+48, 12byte)  varptr(st)+48 を基点に操作(12byte:入れ子/配列)
; IdleTimeout : DWORD (+60, 4byte)  st.15 = 値  /  値 = st.15   (lpoke/lpeek も可)
; IdleSensitivity : BYTE (+64, 1byte)  poke st,64,値  /  値 = peek(st,64)
; DynamicThrottle : BYTE (+65, 1byte)  poke st,65,値  /  値 = peek(st,65)
; Spare2 : BYTE (+66, 2byte)  varptr(st)+66 を基点に操作(2byte:入れ子/配列)
; MinSleep : SYSTEM_POWER_STATE (+68, 4byte)  st.17 = 値  /  値 = st.17   (lpoke/lpeek も可)
; MaxSleep : SYSTEM_POWER_STATE (+72, 4byte)  st.18 = 値  /  値 = st.18   (lpoke/lpeek も可)
; ReducedLatencySleep : SYSTEM_POWER_STATE (+76, 4byte)  st.19 = 値  /  値 = st.19   (lpoke/lpeek も可)
; WinLogonFlags : DWORD (+80, 4byte)  st.20 = 値  /  値 = st.20   (lpoke/lpeek も可)
; Spare3 : DWORD (+84, 4byte)  st.21 = 値  /  値 = st.21   (lpoke/lpeek も可)
; DozeS4Timeout : DWORD (+88, 4byte)  st.22 = 値  /  値 = st.22   (lpoke/lpeek も可)
; BroadcastCapacityResolution : DWORD (+92, 4byte)  st.23 = 値  /  値 = st.23   (lpoke/lpeek も可)
; DischargePolicy : SYSTEM_POWER_LEVEL (+96, 96byte)  varptr(st)+96 を基点に操作(96byte:入れ子/配列)
; VideoTimeout : DWORD (+192, 4byte)  st.48 = 値  /  値 = st.48   (lpoke/lpeek も可)
; VideoDimDisplay : BOOLEAN (+196, 1byte)  poke st,196,値  /  値 = peek(st,196)
; VideoReserved : DWORD (+200, 12byte)  varptr(st)+200 を基点に操作(12byte:入れ子/配列)
; SpindownTimeout : DWORD (+212, 4byte)  st.53 = 値  /  値 = st.53   (lpoke/lpeek も可)
; OptimizeForPower : BOOLEAN (+216, 1byte)  poke st,216,値  /  値 = peek(st,216)
; FanThrottleTolerance : BYTE (+217, 1byte)  poke st,217,値  /  値 = peek(st,217)
; ForcedThrottle : BYTE (+218, 1byte)  poke st,218,値  /  値 = peek(st,218)
; MinThrottle : BYTE (+219, 1byte)  poke st,219,値  /  値 = peek(st,219)
; OverThrottled : POWER_ACTION_POLICY (+220, 12byte)  varptr(st)+220 を基点に操作(12byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global POWER_ACTION_POLICY
    #field int Action
    #field int Flags
    #field int EventCode
#endstruct

#defstruct global SYSTEM_POWER_LEVEL
    #field bool1 Enable
    #field byte Spare 3
    #field int BatteryLevel
    #field POWER_ACTION_POLICY PowerPolicy
    #field int MinSystemState
#endstruct

#defstruct global SYSTEM_POWER_POLICY
    #field int Revision
    #field POWER_ACTION_POLICY PowerButton
    #field POWER_ACTION_POLICY SleepButton
    #field POWER_ACTION_POLICY LidClose
    #field int LidOpenWake
    #field int Reserved
    #field POWER_ACTION_POLICY Idle
    #field int IdleTimeout
    #field byte IdleSensitivity
    #field byte DynamicThrottle
    #field byte Spare2 2
    #field int MinSleep
    #field int MaxSleep
    #field int ReducedLatencySleep
    #field int WinLogonFlags
    #field int Spare3
    #field int DozeS4Timeout
    #field int BroadcastCapacityResolution
    #field SYSTEM_POWER_LEVEL DischargePolicy 4
    #field int VideoTimeout
    #field bool1 VideoDimDisplay
    #field int VideoReserved 3
    #field int SpindownTimeout
    #field bool1 OptimizeForPower
    #field byte FanThrottleTolerance
    #field byte ForcedThrottle
    #field byte MinThrottle
    #field POWER_ACTION_POLICY OverThrottled
#endstruct

stdim st, SYSTEM_POWER_POLICY        ; NSTRUCT 変数を確保
st->Revision = 100
mes "Revision=" + st->Revision