ホーム › Devices.Display › BRIGHTNESS_LEVEL
BRIGHTNESS_LEVEL
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Count | BYTE | 1 | +0 | +0 | 輝度レベルテーブルのエントリ数。 |
| Level | BYTE | 103 | +1 | +1 | サポートする輝度レベルの配列(0〜100%、可変長バイト)。 |
各言語での定義
#include <windows.h>
// BRIGHTNESS_LEVEL (x64 104 / x86 104 バイト)
typedef struct BRIGHTNESS_LEVEL {
BYTE Count;
BYTE Level[103];
} BRIGHTNESS_LEVEL;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct BRIGHTNESS_LEVEL
{
public byte Count;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 103)] public byte[] Level;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure BRIGHTNESS_LEVEL
Public Count As Byte
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=103)> Public Level() As Byte
End Structureimport ctypes
from ctypes import wintypes
class BRIGHTNESS_LEVEL(ctypes.Structure):
_fields_ = [
("Count", ctypes.c_ubyte),
("Level", ctypes.c_ubyte * 103),
]#[repr(C)]
pub struct BRIGHTNESS_LEVEL {
pub Count: u8,
pub Level: [u8; 103],
}import "golang.org/x/sys/windows"
type BRIGHTNESS_LEVEL struct {
Count byte
Level [103]byte
}type
BRIGHTNESS_LEVEL = record
Count: Byte;
Level: array[0..102] of Byte;
end;const BRIGHTNESS_LEVEL = extern struct {
Count: u8,
Level: [103]u8,
};type
BRIGHTNESS_LEVEL {.bycopy.} = object
Count: uint8
Level: array[103, uint8]struct BRIGHTNESS_LEVEL
{
ubyte Count;
ubyte[103] Level;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; BRIGHTNESS_LEVEL サイズ: 104 バイト(x64)
dim st, 26 ; 4byte整数×26(構造体サイズ 104 / 4 切り上げ)
; Count : BYTE (+0, 1byte) poke st,0,値 / 値 = peek(st,0)
; Level : BYTE (+1, 103byte) varptr(st)+1 を基点に操作(103byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global BRIGHTNESS_LEVEL
#field byte Count
#field byte Level 103
#endstruct
stdim st, BRIGHTNESS_LEVEL ; NSTRUCT 変数を確保
st->Count = 100
mes "Count=" + st->Count