Win32 API 日本語リファレンス
ホームMedia.DirectShow › VMR9MonitorInfo

VMR9MonitorInfo

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

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

フィールド

フィールドサイズx64x86説明
uDevIDDWORD4+0+0モニタを識別するデバイスID。
rcMonitorRECT16+4+4デスクトップ座標系でのモニタ矩形(RECT)。
hMonHMONITOR8/4+24+20モニタハンドル(HMONITOR)。
dwFlagsDWORD4+32+24モニタの属性フラグ。プライマリ等を示す。
szDeviceWCHAR64+36+28デバイス名のワイド文字配列。
szDescriptionWCHAR1024+100+92モニタの説明文字列(ワイド文字配列)。
liDriverVersionLONGLONG8+1128+1120ディスプレイドライバのバージョン番号。
dwVendorIdDWORD4+1136+1128ベンダ(製造元)ID。
dwDeviceIdDWORD4+1140+1132デバイスID。
dwSubSysIdDWORD4+1144+1136サブシステムID。
dwRevisionDWORD4+1148+1140リビジョン番号。

各言語での定義

#include <windows.h>

// RECT  (x64 16 / x86 16 バイト)
typedef struct RECT {
    INT left;
    INT top;
    INT right;
    INT bottom;
} RECT;

// VMR9MonitorInfo  (x64 1152 / x86 1144 バイト)
typedef struct VMR9MonitorInfo {
    DWORD uDevID;
    RECT rcMonitor;
    HMONITOR hMon;
    DWORD dwFlags;
    WCHAR szDevice[32];
    WCHAR szDescription[512];
    LONGLONG liDriverVersion;
    DWORD dwVendorId;
    DWORD dwDeviceId;
    DWORD dwSubSysId;
    DWORD dwRevision;
} VMR9MonitorInfo;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct RECT
{
    public int left;
    public int top;
    public int right;
    public int bottom;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct VMR9MonitorInfo
{
    public uint uDevID;
    public RECT rcMonitor;
    public IntPtr hMon;
    public uint dwFlags;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] public string szDevice;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 512)] public string szDescription;
    public long liDriverVersion;
    public uint dwVendorId;
    public uint dwDeviceId;
    public uint dwSubSysId;
    public uint dwRevision;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure RECT
    Public left As Integer
    Public top As Integer
    Public right As Integer
    Public bottom As Integer
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure VMR9MonitorInfo
    Public uDevID As UInteger
    Public rcMonitor As RECT
    Public hMon As IntPtr
    Public dwFlags As UInteger
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=32)> Public szDevice As String
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=512)> Public szDescription As String
    Public liDriverVersion As Long
    Public dwVendorId As UInteger
    Public dwDeviceId As UInteger
    Public dwSubSysId As UInteger
    Public dwRevision As UInteger
End Structure
import ctypes
from ctypes import wintypes

class RECT(ctypes.Structure):
    _fields_ = [
        ("left", ctypes.c_int),
        ("top", ctypes.c_int),
        ("right", ctypes.c_int),
        ("bottom", ctypes.c_int),
    ]

class VMR9MonitorInfo(ctypes.Structure):
    _fields_ = [
        ("uDevID", wintypes.DWORD),
        ("rcMonitor", RECT),
        ("hMon", ctypes.c_void_p),
        ("dwFlags", wintypes.DWORD),
        ("szDevice", ctypes.c_wchar * 32),
        ("szDescription", ctypes.c_wchar * 512),
        ("liDriverVersion", ctypes.c_longlong),
        ("dwVendorId", wintypes.DWORD),
        ("dwDeviceId", wintypes.DWORD),
        ("dwSubSysId", wintypes.DWORD),
        ("dwRevision", wintypes.DWORD),
    ]
#[repr(C)]
pub struct RECT {
    pub left: i32,
    pub top: i32,
    pub right: i32,
    pub bottom: i32,
}

#[repr(C)]
pub struct VMR9MonitorInfo {
    pub uDevID: u32,
    pub rcMonitor: RECT,
    pub hMon: *mut core::ffi::c_void,
    pub dwFlags: u32,
    pub szDevice: [u16; 32],
    pub szDescription: [u16; 512],
    pub liDriverVersion: i64,
    pub dwVendorId: u32,
    pub dwDeviceId: u32,
    pub dwSubSysId: u32,
    pub dwRevision: u32,
}
import "golang.org/x/sys/windows"

type RECT struct {
	left int32
	top int32
	right int32
	bottom int32
}

type VMR9MonitorInfo struct {
	uDevID uint32
	rcMonitor RECT
	hMon uintptr
	dwFlags uint32
	szDevice [32]uint16
	szDescription [512]uint16
	liDriverVersion int64
	dwVendorId uint32
	dwDeviceId uint32
	dwSubSysId uint32
	dwRevision uint32
}
type
  RECT = record
    left: Integer;
    top: Integer;
    right: Integer;
    bottom: Integer;
  end;

  VMR9MonitorInfo = record
    uDevID: DWORD;
    rcMonitor: RECT;
    hMon: Pointer;
    dwFlags: DWORD;
    szDevice: array[0..31] of WideChar;
    szDescription: array[0..511] of WideChar;
    liDriverVersion: Int64;
    dwVendorId: DWORD;
    dwDeviceId: DWORD;
    dwSubSysId: DWORD;
    dwRevision: DWORD;
  end;
const RECT = extern struct {
    left: i32,
    top: i32,
    right: i32,
    bottom: i32,
};

const VMR9MonitorInfo = extern struct {
    uDevID: u32,
    rcMonitor: RECT,
    hMon: ?*anyopaque,
    dwFlags: u32,
    szDevice: [32]u16,
    szDescription: [512]u16,
    liDriverVersion: i64,
    dwVendorId: u32,
    dwDeviceId: u32,
    dwSubSysId: u32,
    dwRevision: u32,
};
type
  RECT {.bycopy.} = object
    left: int32
    top: int32
    right: int32
    bottom: int32

  VMR9MonitorInfo {.bycopy.} = object
    uDevID: uint32
    rcMonitor: RECT
    hMon: pointer
    dwFlags: uint32
    szDevice: array[32, uint16]
    szDescription: array[512, uint16]
    liDriverVersion: int64
    dwVendorId: uint32
    dwDeviceId: uint32
    dwSubSysId: uint32
    dwRevision: uint32
struct RECT
{
    int left;
    int top;
    int right;
    int bottom;
}

struct VMR9MonitorInfo
{
    uint uDevID;
    RECT rcMonitor;
    void* hMon;
    uint dwFlags;
    wchar[32] szDevice;
    wchar[512] szDescription;
    long liDriverVersion;
    uint dwVendorId;
    uint dwDeviceId;
    uint dwSubSysId;
    uint dwRevision;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; VMR9MonitorInfo サイズ: 1144 バイト(x86)
dim st, 286    ; 4byte整数×286(構造体サイズ 1144 / 4 切り上げ)
; uDevID : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; rcMonitor : RECT (+4, 16byte)  varptr(st)+4 を基点に操作(16byte:入れ子/配列)
; hMon : HMONITOR (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; dwFlags : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; szDevice : WCHAR (+28, 64byte)  varptr(st)+28 を基点に操作(64byte:入れ子/配列)
; szDescription : WCHAR (+92, 1024byte)  varptr(st)+92 を基点に操作(1024byte:入れ子/配列)
; liDriverVersion : LONGLONG (+1120, 8byte)  qpoke st,1120,値 / qpeek(st,1120)  ※IronHSPのみ。3.7/3.8は lpoke st,1120,下位 : lpoke st,1124,上位
; dwVendorId : DWORD (+1128, 4byte)  st.282 = 値  /  値 = st.282   (lpoke/lpeek も可)
; dwDeviceId : DWORD (+1132, 4byte)  st.283 = 値  /  値 = st.283   (lpoke/lpeek も可)
; dwSubSysId : DWORD (+1136, 4byte)  st.284 = 値  /  値 = st.284   (lpoke/lpeek も可)
; dwRevision : DWORD (+1140, 4byte)  st.285 = 値  /  値 = st.285   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; VMR9MonitorInfo サイズ: 1152 バイト(x64)
dim st, 288    ; 4byte整数×288(構造体サイズ 1152 / 4 切り上げ)
; uDevID : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; rcMonitor : RECT (+4, 16byte)  varptr(st)+4 を基点に操作(16byte:入れ子/配列)
; hMon : HMONITOR (+24, 8byte)  qpoke st,24,値 / qpeek(st,24)  ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; dwFlags : DWORD (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; szDevice : WCHAR (+36, 64byte)  varptr(st)+36 を基点に操作(64byte:入れ子/配列)
; szDescription : WCHAR (+100, 1024byte)  varptr(st)+100 を基点に操作(1024byte:入れ子/配列)
; liDriverVersion : LONGLONG (+1128, 8byte)  qpoke st,1128,値 / qpeek(st,1128)  ※IronHSPのみ。3.7/3.8は lpoke st,1128,下位 : lpoke st,1132,上位
; dwVendorId : DWORD (+1136, 4byte)  st.284 = 値  /  値 = st.284   (lpoke/lpeek も可)
; dwDeviceId : DWORD (+1140, 4byte)  st.285 = 値  /  値 = st.285   (lpoke/lpeek も可)
; dwSubSysId : DWORD (+1144, 4byte)  st.286 = 値  /  値 = st.286   (lpoke/lpeek も可)
; dwRevision : DWORD (+1148, 4byte)  st.287 = 値  /  値 = st.287   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global RECT
    #field int left
    #field int top
    #field int right
    #field int bottom
#endstruct

#defstruct global VMR9MonitorInfo
    #field int uDevID
    #field RECT rcMonitor
    #field intptr hMon
    #field int dwFlags
    #field wchar szDevice 32
    #field wchar szDescription 512
    #field int64 liDriverVersion
    #field int dwVendorId
    #field int dwDeviceId
    #field int dwSubSysId
    #field int dwRevision
#endstruct

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