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

THERMAL_EVENT

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

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

フィールド

フィールドサイズx64x86説明
VersionDWORD4+0+0イベント構造体のバージョン番号である。
SizeDWORD4+4+4この構造体のバイトサイズである。
TypeDWORD4+8+8発生した熱イベントの種別である。
TemperatureDWORD4+12+12イベント発生時の温度(ケルビンの1/10単位)である。
TripPointTemperatureDWORD4+16+16超過したトリップポイントの温度(ケルビンの1/10単位)である。
InitiatorLPWSTR8/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 Structure
import 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: pointer
struct 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