ホーム › Devices.Display › DISPLAYCONFIG_MODE_INFO
DISPLAYCONFIG_MODE_INFO
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| infoType | DISPLAYCONFIG_MODE_INFO_TYPE | 4 | +0 | +0 | このモード情報の種別(ソース/ターゲット/デスクトップイメージ)。 |
| id | DWORD | 4 | +4 | +4 | ソースまたはターゲットの識別子。 |
| adapterId | LUID | 8 | +8 | +8 | 表示アダプタを一意に識別するLUID。 |
| Anonymous | _Anonymous_e__Union | 56/48 | +16 | +16 | infoTypeに応じたモード情報を格納する無名共用体。 |
共用体: _Anonymous_e__Union x64 56B / x86 48B
| フィールド | 型 | サイズ | x64 | x86 |
|---|---|---|---|---|
| targetMode | DISPLAYCONFIG_TARGET_MODE | 56/48 | +0 | +0 |
| sourceMode | DISPLAYCONFIG_SOURCE_MODE | 20 | +0 | +0 |
| desktopImageInfo | DISPLAYCONFIG_DESKTOP_IMAGE_INFO | 40 | +0 | +0 |
各言語での定義
#include <windows.h>
// LUID (x64 8 / x86 8 バイト)
typedef struct LUID {
DWORD LowPart;
INT HighPart;
} LUID;
// DISPLAYCONFIG_MODE_INFO (x64 72 / x86 64 バイト)
typedef struct DISPLAYCONFIG_MODE_INFO {
DISPLAYCONFIG_MODE_INFO_TYPE infoType;
DWORD id;
LUID adapterId;
_Anonymous_e__Union Anonymous;
} DISPLAYCONFIG_MODE_INFO;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct LUID
{
public uint LowPart;
public int HighPart;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DISPLAYCONFIG_MODE_INFO
{
public int infoType;
public uint id;
public LUID adapterId;
public _Anonymous_e__Union Anonymous;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure LUID
Public LowPart As UInteger
Public HighPart As Integer
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DISPLAYCONFIG_MODE_INFO
Public infoType As Integer
Public id As UInteger
Public adapterId As LUID
Public Anonymous As _Anonymous_e__Union
End Structureimport ctypes
from ctypes import wintypes
class LUID(ctypes.Structure):
_fields_ = [
("LowPart", wintypes.DWORD),
("HighPart", ctypes.c_int),
]
class DISPLAYCONFIG_MODE_INFO(ctypes.Structure):
_fields_ = [
("infoType", ctypes.c_int),
("id", wintypes.DWORD),
("adapterId", LUID),
("Anonymous", _Anonymous_e__Union),
]#[repr(C)]
pub struct LUID {
pub LowPart: u32,
pub HighPart: i32,
}
#[repr(C)]
pub struct DISPLAYCONFIG_MODE_INFO {
pub infoType: i32,
pub id: u32,
pub adapterId: LUID,
pub Anonymous: _Anonymous_e__Union,
}import "golang.org/x/sys/windows"
type LUID struct {
LowPart uint32
HighPart int32
}
type DISPLAYCONFIG_MODE_INFO struct {
infoType int32
id uint32
adapterId LUID
Anonymous _Anonymous_e__Union
}type
LUID = record
LowPart: DWORD;
HighPart: Integer;
end;
DISPLAYCONFIG_MODE_INFO = record
infoType: Integer;
id: DWORD;
adapterId: LUID;
Anonymous: _Anonymous_e__Union;
end;const LUID = extern struct {
LowPart: u32,
HighPart: i32,
};
const DISPLAYCONFIG_MODE_INFO = extern struct {
infoType: i32,
id: u32,
adapterId: LUID,
Anonymous: _Anonymous_e__Union,
};type
LUID {.bycopy.} = object
LowPart: uint32
HighPart: int32
DISPLAYCONFIG_MODE_INFO {.bycopy.} = object
infoType: int32
id: uint32
adapterId: LUID
Anonymous: _Anonymous_e__Unionstruct LUID
{
uint LowPart;
int HighPart;
}
struct DISPLAYCONFIG_MODE_INFO
{
int infoType;
uint id;
LUID adapterId;
_Anonymous_e__Union Anonymous;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; DISPLAYCONFIG_MODE_INFO サイズ: 64 バイト(x86)
dim st, 16 ; 4byte整数×16(構造体サイズ 64 / 4 切り上げ)
; infoType : DISPLAYCONFIG_MODE_INFO_TYPE (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; id : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; adapterId : LUID (+8, 8byte) varptr(st)+8 を基点に操作(8byte:入れ子/配列)
; Anonymous : _Anonymous_e__Union (+16, 48byte) varptr(st)+16 を基点に操作(48byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DISPLAYCONFIG_MODE_INFO サイズ: 72 バイト(x64)
dim st, 18 ; 4byte整数×18(構造体サイズ 72 / 4 切り上げ)
; infoType : DISPLAYCONFIG_MODE_INFO_TYPE (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; id : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; adapterId : LUID (+8, 8byte) varptr(st)+8 を基点に操作(8byte:入れ子/配列)
; Anonymous : _Anonymous_e__Union (+16, 56byte) varptr(st)+16 を基点に操作(56byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global LUID
#field int LowPart
#field int HighPart
#endstruct
#defstruct global DISPLAYCONFIG_MODE_INFO
#field int infoType
#field int id
#field LUID adapterId
#field byte Anonymous 56
#endstruct
stdim st, DISPLAYCONFIG_MODE_INFO ; NSTRUCT 変数を確保
st->infoType = 100
mes "infoType=" + st->infoType
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。