Win32 API 日本語リファレンス
ホームDevices.Display › BRIGHTNESS_NIT_RANGES

BRIGHTNESS_NIT_RANGES

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

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

フィールド

フィールドサイズx64x86説明
NormalRangeCountDWORD4+0+0通常輝度範囲のエントリ数。
RangeCountDWORD4+4+4全輝度範囲(通常+拡張)のエントリ数。
PreferredMaximumBrightnessDWORD4+8+8推奨される最大輝度(ミリニト)。
SupportedRangesBRIGHTNESS_NIT_RANGE192+12+12サポートする輝度範囲(BRIGHTNESS_NIT_RANGE)の配列(可変長)。

各言語での定義

#include <windows.h>

// BRIGHTNESS_NIT_RANGE  (x64 12 / x86 12 バイト)
typedef struct BRIGHTNESS_NIT_RANGE {
    DWORD MinLevelInMillinit;
    DWORD MaxLevelInMillinit;
    DWORD StepSizeInMillinit;
} BRIGHTNESS_NIT_RANGE;

// BRIGHTNESS_NIT_RANGES  (x64 204 / x86 204 バイト)
typedef struct BRIGHTNESS_NIT_RANGES {
    DWORD NormalRangeCount;
    DWORD RangeCount;
    DWORD PreferredMaximumBrightness;
    BRIGHTNESS_NIT_RANGE SupportedRanges[16];
} BRIGHTNESS_NIT_RANGES;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct BRIGHTNESS_NIT_RANGE
{
    public uint MinLevelInMillinit;
    public uint MaxLevelInMillinit;
    public uint StepSizeInMillinit;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct BRIGHTNESS_NIT_RANGES
{
    public uint NormalRangeCount;
    public uint RangeCount;
    public uint PreferredMaximumBrightness;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public BRIGHTNESS_NIT_RANGE[] SupportedRanges;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure BRIGHTNESS_NIT_RANGE
    Public MinLevelInMillinit As UInteger
    Public MaxLevelInMillinit As UInteger
    Public StepSizeInMillinit As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure BRIGHTNESS_NIT_RANGES
    Public NormalRangeCount As UInteger
    Public RangeCount As UInteger
    Public PreferredMaximumBrightness As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=16)> Public SupportedRanges() As BRIGHTNESS_NIT_RANGE
End Structure
import ctypes
from ctypes import wintypes

class BRIGHTNESS_NIT_RANGE(ctypes.Structure):
    _fields_ = [
        ("MinLevelInMillinit", wintypes.DWORD),
        ("MaxLevelInMillinit", wintypes.DWORD),
        ("StepSizeInMillinit", wintypes.DWORD),
    ]

class BRIGHTNESS_NIT_RANGES(ctypes.Structure):
    _fields_ = [
        ("NormalRangeCount", wintypes.DWORD),
        ("RangeCount", wintypes.DWORD),
        ("PreferredMaximumBrightness", wintypes.DWORD),
        ("SupportedRanges", BRIGHTNESS_NIT_RANGE * 16),
    ]
#[repr(C)]
pub struct BRIGHTNESS_NIT_RANGE {
    pub MinLevelInMillinit: u32,
    pub MaxLevelInMillinit: u32,
    pub StepSizeInMillinit: u32,
}

#[repr(C)]
pub struct BRIGHTNESS_NIT_RANGES {
    pub NormalRangeCount: u32,
    pub RangeCount: u32,
    pub PreferredMaximumBrightness: u32,
    pub SupportedRanges: [BRIGHTNESS_NIT_RANGE; 16],
}
import "golang.org/x/sys/windows"

type BRIGHTNESS_NIT_RANGE struct {
	MinLevelInMillinit uint32
	MaxLevelInMillinit uint32
	StepSizeInMillinit uint32
}

type BRIGHTNESS_NIT_RANGES struct {
	NormalRangeCount uint32
	RangeCount uint32
	PreferredMaximumBrightness uint32
	SupportedRanges [16]BRIGHTNESS_NIT_RANGE
}
type
  BRIGHTNESS_NIT_RANGE = record
    MinLevelInMillinit: DWORD;
    MaxLevelInMillinit: DWORD;
    StepSizeInMillinit: DWORD;
  end;

  BRIGHTNESS_NIT_RANGES = record
    NormalRangeCount: DWORD;
    RangeCount: DWORD;
    PreferredMaximumBrightness: DWORD;
    SupportedRanges: array[0..15] of BRIGHTNESS_NIT_RANGE;
  end;
const BRIGHTNESS_NIT_RANGE = extern struct {
    MinLevelInMillinit: u32,
    MaxLevelInMillinit: u32,
    StepSizeInMillinit: u32,
};

const BRIGHTNESS_NIT_RANGES = extern struct {
    NormalRangeCount: u32,
    RangeCount: u32,
    PreferredMaximumBrightness: u32,
    SupportedRanges: [16]BRIGHTNESS_NIT_RANGE,
};
type
  BRIGHTNESS_NIT_RANGE {.bycopy.} = object
    MinLevelInMillinit: uint32
    MaxLevelInMillinit: uint32
    StepSizeInMillinit: uint32

  BRIGHTNESS_NIT_RANGES {.bycopy.} = object
    NormalRangeCount: uint32
    RangeCount: uint32
    PreferredMaximumBrightness: uint32
    SupportedRanges: array[16, BRIGHTNESS_NIT_RANGE]
struct BRIGHTNESS_NIT_RANGE
{
    uint MinLevelInMillinit;
    uint MaxLevelInMillinit;
    uint StepSizeInMillinit;
}

struct BRIGHTNESS_NIT_RANGES
{
    uint NormalRangeCount;
    uint RangeCount;
    uint PreferredMaximumBrightness;
    BRIGHTNESS_NIT_RANGE[16] SupportedRanges;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; BRIGHTNESS_NIT_RANGES サイズ: 204 バイト(x64)
dim st, 51    ; 4byte整数×51(構造体サイズ 204 / 4 切り上げ)
; NormalRangeCount : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; RangeCount : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; PreferredMaximumBrightness : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; SupportedRanges : BRIGHTNESS_NIT_RANGE (+12, 192byte)  varptr(st)+12 を基点に操作(192byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global BRIGHTNESS_NIT_RANGE
    #field int MinLevelInMillinit
    #field int MaxLevelInMillinit
    #field int StepSizeInMillinit
#endstruct

#defstruct global BRIGHTNESS_NIT_RANGES
    #field int NormalRangeCount
    #field int RangeCount
    #field int PreferredMaximumBrightness
    #field BRIGHTNESS_NIT_RANGE SupportedRanges 16
#endstruct

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