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

VMRMONITORINFO

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

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

フィールド

フィールドサイズx64x86説明
guidVMRGUID24/20+0+0モニターに対応するDirectDrawデバイスを示すVMRGUID構造体。
rcMonitorRECT16+24+20デスクトップ座標系でのモニター矩形を示すRECT構造体。
hMonHMONITOR8/4+40+36モニターのハンドルを示す。
dwFlagsDWORD4+48+40モニターの状態を示すフラグを示す。
szDeviceWCHAR64+52+44デバイス名を示すワイド文字配列。
szDescriptionWCHAR512+116+108デバイスの説明を示すワイド文字配列。
liDriverVersionLONGLONG8+632+624ディスプレイドライバーのバージョンを示す。
dwVendorIdDWORD4+640+632ハードウェアのベンダー識別子を示す。
dwDeviceIdDWORD4+644+636ハードウェアのデバイス識別子を示す。
dwSubSysIdDWORD4+648+640サブシステムの識別子を示す。
dwRevisionDWORD4+652+644ハードウェアのリビジョン番号を示す。

各言語での定義

#include <windows.h>

// VMRGUID  (x64 24 / x86 20 バイト)
typedef struct VMRGUID {
    GUID* pGUID;
    GUID GUID;
} VMRGUID;

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

// VMRMONITORINFO  (x64 656 / x86 648 バイト)
typedef struct VMRMONITORINFO {
    VMRGUID guid;
    RECT rcMonitor;
    HMONITOR hMon;
    DWORD dwFlags;
    WCHAR szDevice[32];
    WCHAR szDescription[256];
    LONGLONG liDriverVersion;
    DWORD dwVendorId;
    DWORD dwDeviceId;
    DWORD dwSubSysId;
    DWORD dwRevision;
} VMRMONITORINFO;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct VMRGUID
{
    public IntPtr pGUID;
    public Guid GUID;
}

[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 VMRMONITORINFO
{
    public VMRGUID guid;
    public RECT rcMonitor;
    public IntPtr hMon;
    public uint dwFlags;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] public string szDevice;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] 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 VMRGUID
    Public pGUID As IntPtr
    Public GUID As Guid
End Structure

<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 VMRMONITORINFO
    Public guid As VMRGUID
    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:=256)> 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 VMRGUID(ctypes.Structure):
    _fields_ = [
        ("pGUID", ctypes.c_void_p),
        ("GUID", GUID),
    ]

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

class VMRMONITORINFO(ctypes.Structure):
    _fields_ = [
        ("guid", VMRGUID),
        ("rcMonitor", RECT),
        ("hMon", ctypes.c_void_p),
        ("dwFlags", wintypes.DWORD),
        ("szDevice", ctypes.c_wchar * 32),
        ("szDescription", ctypes.c_wchar * 256),
        ("liDriverVersion", ctypes.c_longlong),
        ("dwVendorId", wintypes.DWORD),
        ("dwDeviceId", wintypes.DWORD),
        ("dwSubSysId", wintypes.DWORD),
        ("dwRevision", wintypes.DWORD),
    ]
#[repr(C)]
pub struct VMRGUID {
    pub pGUID: *mut core::ffi::c_void,
    pub GUID: GUID,
}

#[repr(C)]
pub struct RECT {
    pub left: i32,
    pub top: i32,
    pub right: i32,
    pub bottom: i32,
}

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

type VMRGUID struct {
	pGUID uintptr
	GUID windows.GUID
}

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

type VMRMONITORINFO struct {
	guid VMRGUID
	rcMonitor RECT
	hMon uintptr
	dwFlags uint32
	szDevice [32]uint16
	szDescription [256]uint16
	liDriverVersion int64
	dwVendorId uint32
	dwDeviceId uint32
	dwSubSysId uint32
	dwRevision uint32
}
type
  VMRGUID = record
    pGUID: Pointer;
    GUID: TGUID;
  end;

  RECT = record
    left: Integer;
    top: Integer;
    right: Integer;
    bottom: Integer;
  end;

  VMRMONITORINFO = record
    guid: VMRGUID;
    rcMonitor: RECT;
    hMon: Pointer;
    dwFlags: DWORD;
    szDevice: array[0..31] of WideChar;
    szDescription: array[0..255] of WideChar;
    liDriverVersion: Int64;
    dwVendorId: DWORD;
    dwDeviceId: DWORD;
    dwSubSysId: DWORD;
    dwRevision: DWORD;
  end;
const VMRGUID = extern struct {
    pGUID: ?*anyopaque,
    GUID: GUID,
};

const RECT = extern struct {
    left: i32,
    top: i32,
    right: i32,
    bottom: i32,
};

const VMRMONITORINFO = extern struct {
    guid: VMRGUID,
    rcMonitor: RECT,
    hMon: ?*anyopaque,
    dwFlags: u32,
    szDevice: [32]u16,
    szDescription: [256]u16,
    liDriverVersion: i64,
    dwVendorId: u32,
    dwDeviceId: u32,
    dwSubSysId: u32,
    dwRevision: u32,
};
type
  VMRGUID {.bycopy.} = object
    pGUID: pointer
    GUID: GUID

  RECT {.bycopy.} = object
    left: int32
    top: int32
    right: int32
    bottom: int32

  VMRMONITORINFO {.bycopy.} = object
    guid: VMRGUID
    rcMonitor: RECT
    hMon: pointer
    dwFlags: uint32
    szDevice: array[32, uint16]
    szDescription: array[256, uint16]
    liDriverVersion: int64
    dwVendorId: uint32
    dwDeviceId: uint32
    dwSubSysId: uint32
    dwRevision: uint32
struct VMRGUID
{
    void* pGUID;
    GUID GUID;
}

struct RECT
{
    int left;
    int top;
    int right;
    int bottom;
}

struct VMRMONITORINFO
{
    VMRGUID guid;
    RECT rcMonitor;
    void* hMon;
    uint dwFlags;
    wchar[32] szDevice;
    wchar[256] 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 レイアウト)
; VMRMONITORINFO サイズ: 648 バイト(x86)
dim st, 162    ; 4byte整数×162(構造体サイズ 648 / 4 切り上げ)
; guid : VMRGUID (+0, 20byte)  varptr(st)+0 を基点に操作(20byte:入れ子/配列)
; rcMonitor : RECT (+20, 16byte)  varptr(st)+20 を基点に操作(16byte:入れ子/配列)
; hMon : HMONITOR (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; dwFlags : DWORD (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; szDevice : WCHAR (+44, 64byte)  varptr(st)+44 を基点に操作(64byte:入れ子/配列)
; szDescription : WCHAR (+108, 512byte)  varptr(st)+108 を基点に操作(512byte:入れ子/配列)
; liDriverVersion : LONGLONG (+624, 8byte)  qpoke st,624,値 / qpeek(st,624)  ※IronHSPのみ。3.7/3.8は lpoke st,624,下位 : lpoke st,628,上位
; dwVendorId : DWORD (+632, 4byte)  st.158 = 値  /  値 = st.158   (lpoke/lpeek も可)
; dwDeviceId : DWORD (+636, 4byte)  st.159 = 値  /  値 = st.159   (lpoke/lpeek も可)
; dwSubSysId : DWORD (+640, 4byte)  st.160 = 値  /  値 = st.160   (lpoke/lpeek も可)
; dwRevision : DWORD (+644, 4byte)  st.161 = 値  /  値 = st.161   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; VMRMONITORINFO サイズ: 656 バイト(x64)
dim st, 164    ; 4byte整数×164(構造体サイズ 656 / 4 切り上げ)
; guid : VMRGUID (+0, 24byte)  varptr(st)+0 を基点に操作(24byte:入れ子/配列)
; rcMonitor : RECT (+24, 16byte)  varptr(st)+24 を基点に操作(16byte:入れ子/配列)
; hMon : HMONITOR (+40, 8byte)  qpoke st,40,値 / qpeek(st,40)  ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; dwFlags : DWORD (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; szDevice : WCHAR (+52, 64byte)  varptr(st)+52 を基点に操作(64byte:入れ子/配列)
; szDescription : WCHAR (+116, 512byte)  varptr(st)+116 を基点に操作(512byte:入れ子/配列)
; liDriverVersion : LONGLONG (+632, 8byte)  qpoke st,632,値 / qpeek(st,632)  ※IronHSPのみ。3.7/3.8は lpoke st,632,下位 : lpoke st,636,上位
; dwVendorId : DWORD (+640, 4byte)  st.160 = 値  /  値 = st.160   (lpoke/lpeek も可)
; dwDeviceId : DWORD (+644, 4byte)  st.161 = 値  /  値 = st.161   (lpoke/lpeek も可)
; dwSubSysId : DWORD (+648, 4byte)  st.162 = 値  /  値 = st.162   (lpoke/lpeek も可)
; dwRevision : DWORD (+652, 4byte)  st.163 = 値  /  値 = st.163   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global GUID, pack=1
    #field int Data1
    #field short Data2
    #field short Data3
    #field byte Data4 8
#endstruct

#defstruct global VMRGUID
    #field intptr pGUID
    #field GUID GUID
#endstruct

#defstruct global RECT
    #field int left
    #field int top
    #field int right
    #field int bottom
#endstruct

#defstruct global VMRMONITORINFO
    #field VMRGUID guid
    #field RECT rcMonitor
    #field intptr hMon
    #field int dwFlags
    #field wchar szDevice 32
    #field wchar szDescription 256
    #field int64 liDriverVersion
    #field int dwVendorId
    #field int dwDeviceId
    #field int dwSubSysId
    #field int dwRevision
#endstruct

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