ホーム › Devices.Display › PHYSICAL_MONITOR
PHYSICAL_MONITOR
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| hPhysicalMonitor | HANDLE | 8/4 | +0 | +0 | 物理モニターを参照するハンドル。DDC/CI操作などに使用する。使用後は破棄が必要。 |
| szPhysicalMonitorDescription | WCHAR | 256 | +8 | +4 | 物理モニターの説明文字列(ワイド文字)。最大128文字程度の表示名を保持する。 |
各言語での定義
#include <windows.h>
// PHYSICAL_MONITOR (x64 264 / x86 260 バイト)
#pragma pack(push, 1)
typedef struct PHYSICAL_MONITOR {
HANDLE hPhysicalMonitor;
WCHAR szPhysicalMonitorDescription[128];
} PHYSICAL_MONITOR;
#pragma pack(pop)using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct PHYSICAL_MONITOR
{
public IntPtr hPhysicalMonitor;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] public string szPhysicalMonitorDescription;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure PHYSICAL_MONITOR
Public hPhysicalMonitor As IntPtr
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=128)> Public szPhysicalMonitorDescription As String
End Structureimport ctypes
from ctypes import wintypes
class PHYSICAL_MONITOR(ctypes.Structure):
_pack_ = 1
_fields_ = [
("hPhysicalMonitor", ctypes.c_void_p),
("szPhysicalMonitorDescription", ctypes.c_wchar * 128),
]#[repr(C, packed(1))]
pub struct PHYSICAL_MONITOR {
pub hPhysicalMonitor: *mut core::ffi::c_void,
pub szPhysicalMonitorDescription: [u16; 128],
}import "golang.org/x/sys/windows"
type PHYSICAL_MONITOR struct {
hPhysicalMonitor uintptr
szPhysicalMonitorDescription [128]uint16
}type
PHYSICAL_MONITOR = packed record
hPhysicalMonitor: Pointer;
szPhysicalMonitorDescription: array[0..127] of WideChar;
end;const PHYSICAL_MONITOR = extern struct {
hPhysicalMonitor: ?*anyopaque,
szPhysicalMonitorDescription: [128]u16,
};type
PHYSICAL_MONITOR {.packed.} = object
hPhysicalMonitor: pointer
szPhysicalMonitorDescription: array[128, uint16]align(1)
struct PHYSICAL_MONITOR
{
void* hPhysicalMonitor;
wchar[128] szPhysicalMonitorDescription;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; PHYSICAL_MONITOR サイズ: 260 バイト(x86)
dim st, 65 ; 4byte整数×65(構造体サイズ 260 / 4 切り上げ)
; hPhysicalMonitor : HANDLE (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; szPhysicalMonitorDescription : WCHAR (+4, 256byte) varptr(st)+4 を基点に操作(256byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; PHYSICAL_MONITOR サイズ: 264 バイト(x64)
dim st, 66 ; 4byte整数×66(構造体サイズ 264 / 4 切り上げ)
; hPhysicalMonitor : HANDLE (+0, 8byte) qpoke st,0,値 / qpeek(st,0) ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; szPhysicalMonitorDescription : WCHAR (+8, 256byte) varptr(st)+8 を基点に操作(256byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global PHYSICAL_MONITOR, pack=1
#field intptr hPhysicalMonitor
#field wchar szPhysicalMonitorDescription 128
#endstruct
stdim st, PHYSICAL_MONITOR ; NSTRUCT 変数を確保