ホーム › System.SystemServices › POWER_LIMIT_ATTRIBUTES
POWER_LIMIT_ATTRIBUTES
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Type | POWER_LIMIT_TYPES | 4 | +0 | +0 | 電力制限の種類を示す。 |
| DomainId | DWORD | 4 | +4 | +4 | 電力制限を適用するドメインの識別子。 |
| MaxValue | DWORD | 4 | +8 | +8 | 設定可能な最大値。 |
| MinValue | DWORD | 4 | +12 | +12 | 設定可能な最小値。 |
| MinTimeParameter | DWORD | 4 | +16 | +16 | 時間窓パラメータの最小値。 |
| MaxTimeParameter | DWORD | 4 | +20 | +20 | 時間窓パラメータの最大値。 |
| DefaultACValue | DWORD | 4 | +24 | +24 | AC電源接続時の既定値。 |
| DefaultDCValue | DWORD | 4 | +28 | +28 | DC(バッテリ)動作時の既定値。 |
| Flags | _Flags_e__Union | 8/4 | +32 | +32 | 電力制限属性のフラグを保持する無名共用体。 |
共用体: _Flags_e__Union x64 8B / x86 4B
| フィールド | 型 | サイズ | x64 | x86 |
|---|---|---|---|---|
| Anonymous | _Anonymous_e__Struct | 8/4 | +0 | +0 |
| AsUlong | DWORD | 4 | +0 | +0 |
各言語での定義
#include <windows.h>
// POWER_LIMIT_ATTRIBUTES (x64 40 / x86 36 バイト)
typedef struct POWER_LIMIT_ATTRIBUTES {
POWER_LIMIT_TYPES Type;
DWORD DomainId;
DWORD MaxValue;
DWORD MinValue;
DWORD MinTimeParameter;
DWORD MaxTimeParameter;
DWORD DefaultACValue;
DWORD DefaultDCValue;
_Flags_e__Union Flags;
} POWER_LIMIT_ATTRIBUTES;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct POWER_LIMIT_ATTRIBUTES
{
public int Type;
public uint DomainId;
public uint MaxValue;
public uint MinValue;
public uint MinTimeParameter;
public uint MaxTimeParameter;
public uint DefaultACValue;
public uint DefaultDCValue;
public _Flags_e__Union Flags;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure POWER_LIMIT_ATTRIBUTES
Public Type As Integer
Public DomainId As UInteger
Public MaxValue As UInteger
Public MinValue As UInteger
Public MinTimeParameter As UInteger
Public MaxTimeParameter As UInteger
Public DefaultACValue As UInteger
Public DefaultDCValue As UInteger
Public Flags As _Flags_e__Union
End Structureimport ctypes
from ctypes import wintypes
class POWER_LIMIT_ATTRIBUTES(ctypes.Structure):
_fields_ = [
("Type", ctypes.c_int),
("DomainId", wintypes.DWORD),
("MaxValue", wintypes.DWORD),
("MinValue", wintypes.DWORD),
("MinTimeParameter", wintypes.DWORD),
("MaxTimeParameter", wintypes.DWORD),
("DefaultACValue", wintypes.DWORD),
("DefaultDCValue", wintypes.DWORD),
("Flags", _Flags_e__Union),
]#[repr(C)]
pub struct POWER_LIMIT_ATTRIBUTES {
pub Type: i32,
pub DomainId: u32,
pub MaxValue: u32,
pub MinValue: u32,
pub MinTimeParameter: u32,
pub MaxTimeParameter: u32,
pub DefaultACValue: u32,
pub DefaultDCValue: u32,
pub Flags: _Flags_e__Union,
}import "golang.org/x/sys/windows"
type POWER_LIMIT_ATTRIBUTES struct {
Type int32
DomainId uint32
MaxValue uint32
MinValue uint32
MinTimeParameter uint32
MaxTimeParameter uint32
DefaultACValue uint32
DefaultDCValue uint32
Flags _Flags_e__Union
}type
POWER_LIMIT_ATTRIBUTES = record
Type: Integer;
DomainId: DWORD;
MaxValue: DWORD;
MinValue: DWORD;
MinTimeParameter: DWORD;
MaxTimeParameter: DWORD;
DefaultACValue: DWORD;
DefaultDCValue: DWORD;
Flags: _Flags_e__Union;
end;const POWER_LIMIT_ATTRIBUTES = extern struct {
Type: i32,
DomainId: u32,
MaxValue: u32,
MinValue: u32,
MinTimeParameter: u32,
MaxTimeParameter: u32,
DefaultACValue: u32,
DefaultDCValue: u32,
Flags: _Flags_e__Union,
};type
POWER_LIMIT_ATTRIBUTES {.bycopy.} = object
Type: int32
DomainId: uint32
MaxValue: uint32
MinValue: uint32
MinTimeParameter: uint32
MaxTimeParameter: uint32
DefaultACValue: uint32
DefaultDCValue: uint32
Flags: _Flags_e__Unionstruct POWER_LIMIT_ATTRIBUTES
{
int Type;
uint DomainId;
uint MaxValue;
uint MinValue;
uint MinTimeParameter;
uint MaxTimeParameter;
uint DefaultACValue;
uint DefaultDCValue;
_Flags_e__Union Flags;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; POWER_LIMIT_ATTRIBUTES サイズ: 36 バイト(x86)
dim st, 9 ; 4byte整数×9(構造体サイズ 36 / 4 切り上げ)
; Type : POWER_LIMIT_TYPES (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; DomainId : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; MaxValue : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; MinValue : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; MinTimeParameter : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; MaxTimeParameter : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; DefaultACValue : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; DefaultDCValue : DWORD (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; Flags : _Flags_e__Union (+32, 4byte) varptr(st)+32 を基点に操作(4byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; POWER_LIMIT_ATTRIBUTES サイズ: 40 バイト(x64)
dim st, 10 ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; Type : POWER_LIMIT_TYPES (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; DomainId : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; MaxValue : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; MinValue : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; MinTimeParameter : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; MaxTimeParameter : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; DefaultACValue : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; DefaultDCValue : DWORD (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; Flags : _Flags_e__Union (+32, 8byte) varptr(st)+32 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global POWER_LIMIT_ATTRIBUTES
#field int Type
#field int DomainId
#field int MaxValue
#field int MinValue
#field int MinTimeParameter
#field int MaxTimeParameter
#field int DefaultACValue
#field int DefaultDCValue
#field byte Flags 8
#endstruct
stdim st, POWER_LIMIT_ATTRIBUTES ; NSTRUCT 変数を確保
st->Type = 100
mes "Type=" + st->Type
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。