ホーム › System.Power › THERMAL_EVENT
THERMAL_EVENT
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Version | DWORD | 4 | +0 | +0 | イベント構造体のバージョン番号である。 |
| Size | DWORD | 4 | +4 | +4 | この構造体のバイトサイズである。 |
| Type | DWORD | 4 | +8 | +8 | 発生した熱イベントの種別である。 |
| Temperature | DWORD | 4 | +12 | +12 | イベント発生時の温度(ケルビンの1/10単位)である。 |
| TripPointTemperature | DWORD | 4 | +16 | +16 | 超過したトリップポイントの温度(ケルビンの1/10単位)である。 |
| Initiator | LPWSTR | 8/4 | +24 | +20 | イベントを発生させた要因の説明文字列(ワイド)である。 |
各言語での定義
#include <windows.h>
// THERMAL_EVENT (x64 32 / x86 24 バイト)
typedef struct THERMAL_EVENT {
DWORD Version;
DWORD Size;
DWORD Type;
DWORD Temperature;
DWORD TripPointTemperature;
LPWSTR Initiator;
} THERMAL_EVENT;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct THERMAL_EVENT
{
public uint Version;
public uint Size;
public uint Type;
public uint Temperature;
public uint TripPointTemperature;
public IntPtr Initiator;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure THERMAL_EVENT
Public Version As UInteger
Public Size As UInteger
Public Type As UInteger
Public Temperature As UInteger
Public TripPointTemperature As UInteger
Public Initiator As IntPtr
End Structureimport ctypes
from ctypes import wintypes
class THERMAL_EVENT(ctypes.Structure):
_fields_ = [
("Version", wintypes.DWORD),
("Size", wintypes.DWORD),
("Type", wintypes.DWORD),
("Temperature", wintypes.DWORD),
("TripPointTemperature", wintypes.DWORD),
("Initiator", ctypes.c_void_p),
]#[repr(C)]
pub struct THERMAL_EVENT {
pub Version: u32,
pub Size: u32,
pub Type: u32,
pub Temperature: u32,
pub TripPointTemperature: u32,
pub Initiator: *mut core::ffi::c_void,
}import "golang.org/x/sys/windows"
type THERMAL_EVENT struct {
Version uint32
Size uint32
Type uint32
Temperature uint32
TripPointTemperature uint32
Initiator uintptr
}type
THERMAL_EVENT = record
Version: DWORD;
Size: DWORD;
Type: DWORD;
Temperature: DWORD;
TripPointTemperature: DWORD;
Initiator: Pointer;
end;const THERMAL_EVENT = extern struct {
Version: u32,
Size: u32,
Type: u32,
Temperature: u32,
TripPointTemperature: u32,
Initiator: ?*anyopaque,
};type
THERMAL_EVENT {.bycopy.} = object
Version: uint32
Size: uint32
Type: uint32
Temperature: uint32
TripPointTemperature: uint32
Initiator: pointerstruct THERMAL_EVENT
{
uint Version;
uint Size;
uint Type;
uint Temperature;
uint TripPointTemperature;
void* Initiator;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; THERMAL_EVENT サイズ: 24 バイト(x86)
dim st, 6 ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; Version : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; Size : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; Type : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; Temperature : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; TripPointTemperature : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; Initiator : LPWSTR (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; THERMAL_EVENT サイズ: 32 バイト(x64)
dim st, 8 ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; Version : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; Size : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; Type : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; Temperature : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; TripPointTemperature : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; Initiator : LPWSTR (+24, 8byte) qpoke st,24,値 / qpeek(st,24) ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global THERMAL_EVENT
#field int Version
#field int Size
#field int Type
#field int Temperature
#field int TripPointTemperature
#field intptr Initiator
#endstruct
stdim st, THERMAL_EVENT ; NSTRUCT 変数を確保
st->Version = 100
mes "Version=" + st->Version