Win32 API 日本語リファレンス
ホームGraphics.DirectDraw › DDVIDEOPORTDESC

DDVIDEOPORTDESC

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

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

フィールド

フィールドサイズx64x86説明
dwSizeDWORD4+0+0構造体サイズ(バイト数)。呼び出し前に設定する。
dwFieldWidthDWORD4+4+41フィールドの幅(ピクセル)を示す。
dwVBIWidthDWORD4+8+8VBIデータの幅(ピクセル)を示す。
dwFieldHeightDWORD4+12+121フィールドの高さ(ライン)を示す。
dwMicrosecondsPerFieldDWORD4+16+161フィールドあたりの時間(マイクロ秒)を示す。
dwMaxPixelsPerSecondDWORD4+20+20毎秒の最大ピクセル転送数を示す。
dwVideoPortIDDWORD4+24+24ビデオポートの識別子を示す。
dwReserved1DWORD4+28+28予約フィールド。0とする。
VideoPortTypeDDVIDEOPORTCONNECT40/32+32+32ビデオポートの接続タイプ(DDVIDEOPORTCONNECT)。
dwReserved2UINT_PTR8/4+72+64予約フィールド。0とする。
dwReserved3UINT_PTR8/4+80+68予約フィールド。0とする。

各言語での定義

#include <windows.h>

// DDVIDEOPORTCONNECT  (x64 40 / x86 32 バイト)
typedef struct DDVIDEOPORTCONNECT {
    DWORD dwSize;
    DWORD dwPortWidth;
    GUID guidTypeID;
    DWORD dwFlags;
    UINT_PTR dwReserved1;
} DDVIDEOPORTCONNECT;

// DDVIDEOPORTDESC  (x64 88 / x86 72 バイト)
typedef struct DDVIDEOPORTDESC {
    DWORD dwSize;
    DWORD dwFieldWidth;
    DWORD dwVBIWidth;
    DWORD dwFieldHeight;
    DWORD dwMicrosecondsPerField;
    DWORD dwMaxPixelsPerSecond;
    DWORD dwVideoPortID;
    DWORD dwReserved1;
    DDVIDEOPORTCONNECT VideoPortType;
    UINT_PTR dwReserved2;
    UINT_PTR dwReserved3;
} DDVIDEOPORTDESC;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DDVIDEOPORTCONNECT
{
    public uint dwSize;
    public uint dwPortWidth;
    public Guid guidTypeID;
    public uint dwFlags;
    public UIntPtr dwReserved1;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DDVIDEOPORTDESC
{
    public uint dwSize;
    public uint dwFieldWidth;
    public uint dwVBIWidth;
    public uint dwFieldHeight;
    public uint dwMicrosecondsPerField;
    public uint dwMaxPixelsPerSecond;
    public uint dwVideoPortID;
    public uint dwReserved1;
    public DDVIDEOPORTCONNECT VideoPortType;
    public UIntPtr dwReserved2;
    public UIntPtr dwReserved3;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DDVIDEOPORTCONNECT
    Public dwSize As UInteger
    Public dwPortWidth As UInteger
    Public guidTypeID As Guid
    Public dwFlags As UInteger
    Public dwReserved1 As UIntPtr
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DDVIDEOPORTDESC
    Public dwSize As UInteger
    Public dwFieldWidth As UInteger
    Public dwVBIWidth As UInteger
    Public dwFieldHeight As UInteger
    Public dwMicrosecondsPerField As UInteger
    Public dwMaxPixelsPerSecond As UInteger
    Public dwVideoPortID As UInteger
    Public dwReserved1 As UInteger
    Public VideoPortType As DDVIDEOPORTCONNECT
    Public dwReserved2 As UIntPtr
    Public dwReserved3 As UIntPtr
End Structure
import ctypes
from ctypes import wintypes

class DDVIDEOPORTCONNECT(ctypes.Structure):
    _fields_ = [
        ("dwSize", wintypes.DWORD),
        ("dwPortWidth", wintypes.DWORD),
        ("guidTypeID", GUID),
        ("dwFlags", wintypes.DWORD),
        ("dwReserved1", ctypes.c_size_t),
    ]

class DDVIDEOPORTDESC(ctypes.Structure):
    _fields_ = [
        ("dwSize", wintypes.DWORD),
        ("dwFieldWidth", wintypes.DWORD),
        ("dwVBIWidth", wintypes.DWORD),
        ("dwFieldHeight", wintypes.DWORD),
        ("dwMicrosecondsPerField", wintypes.DWORD),
        ("dwMaxPixelsPerSecond", wintypes.DWORD),
        ("dwVideoPortID", wintypes.DWORD),
        ("dwReserved1", wintypes.DWORD),
        ("VideoPortType", DDVIDEOPORTCONNECT),
        ("dwReserved2", ctypes.c_size_t),
        ("dwReserved3", ctypes.c_size_t),
    ]
#[repr(C)]
pub struct DDVIDEOPORTCONNECT {
    pub dwSize: u32,
    pub dwPortWidth: u32,
    pub guidTypeID: GUID,
    pub dwFlags: u32,
    pub dwReserved1: usize,
}

#[repr(C)]
pub struct DDVIDEOPORTDESC {
    pub dwSize: u32,
    pub dwFieldWidth: u32,
    pub dwVBIWidth: u32,
    pub dwFieldHeight: u32,
    pub dwMicrosecondsPerField: u32,
    pub dwMaxPixelsPerSecond: u32,
    pub dwVideoPortID: u32,
    pub dwReserved1: u32,
    pub VideoPortType: DDVIDEOPORTCONNECT,
    pub dwReserved2: usize,
    pub dwReserved3: usize,
}
import "golang.org/x/sys/windows"

type DDVIDEOPORTCONNECT struct {
	dwSize uint32
	dwPortWidth uint32
	guidTypeID windows.GUID
	dwFlags uint32
	dwReserved1 uintptr
}

type DDVIDEOPORTDESC struct {
	dwSize uint32
	dwFieldWidth uint32
	dwVBIWidth uint32
	dwFieldHeight uint32
	dwMicrosecondsPerField uint32
	dwMaxPixelsPerSecond uint32
	dwVideoPortID uint32
	dwReserved1 uint32
	VideoPortType DDVIDEOPORTCONNECT
	dwReserved2 uintptr
	dwReserved3 uintptr
}
type
  DDVIDEOPORTCONNECT = record
    dwSize: DWORD;
    dwPortWidth: DWORD;
    guidTypeID: TGUID;
    dwFlags: DWORD;
    dwReserved1: NativeUInt;
  end;

  DDVIDEOPORTDESC = record
    dwSize: DWORD;
    dwFieldWidth: DWORD;
    dwVBIWidth: DWORD;
    dwFieldHeight: DWORD;
    dwMicrosecondsPerField: DWORD;
    dwMaxPixelsPerSecond: DWORD;
    dwVideoPortID: DWORD;
    dwReserved1: DWORD;
    VideoPortType: DDVIDEOPORTCONNECT;
    dwReserved2: NativeUInt;
    dwReserved3: NativeUInt;
  end;
const DDVIDEOPORTCONNECT = extern struct {
    dwSize: u32,
    dwPortWidth: u32,
    guidTypeID: GUID,
    dwFlags: u32,
    dwReserved1: usize,
};

const DDVIDEOPORTDESC = extern struct {
    dwSize: u32,
    dwFieldWidth: u32,
    dwVBIWidth: u32,
    dwFieldHeight: u32,
    dwMicrosecondsPerField: u32,
    dwMaxPixelsPerSecond: u32,
    dwVideoPortID: u32,
    dwReserved1: u32,
    VideoPortType: DDVIDEOPORTCONNECT,
    dwReserved2: usize,
    dwReserved3: usize,
};
type
  DDVIDEOPORTCONNECT {.bycopy.} = object
    dwSize: uint32
    dwPortWidth: uint32
    guidTypeID: GUID
    dwFlags: uint32
    dwReserved1: uint

  DDVIDEOPORTDESC {.bycopy.} = object
    dwSize: uint32
    dwFieldWidth: uint32
    dwVBIWidth: uint32
    dwFieldHeight: uint32
    dwMicrosecondsPerField: uint32
    dwMaxPixelsPerSecond: uint32
    dwVideoPortID: uint32
    dwReserved1: uint32
    VideoPortType: DDVIDEOPORTCONNECT
    dwReserved2: uint
    dwReserved3: uint
struct DDVIDEOPORTCONNECT
{
    uint dwSize;
    uint dwPortWidth;
    GUID guidTypeID;
    uint dwFlags;
    size_t dwReserved1;
}

struct DDVIDEOPORTDESC
{
    uint dwSize;
    uint dwFieldWidth;
    uint dwVBIWidth;
    uint dwFieldHeight;
    uint dwMicrosecondsPerField;
    uint dwMaxPixelsPerSecond;
    uint dwVideoPortID;
    uint dwReserved1;
    DDVIDEOPORTCONNECT VideoPortType;
    size_t dwReserved2;
    size_t dwReserved3;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; DDVIDEOPORTDESC サイズ: 72 バイト(x86)
dim st, 18    ; 4byte整数×18(構造体サイズ 72 / 4 切り上げ)
; dwSize : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; dwFieldWidth : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; dwVBIWidth : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; dwFieldHeight : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; dwMicrosecondsPerField : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; dwMaxPixelsPerSecond : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; dwVideoPortID : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; dwReserved1 : DWORD (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; VideoPortType : DDVIDEOPORTCONNECT (+32, 32byte)  varptr(st)+32 を基点に操作(32byte:入れ子/配列)
; dwReserved2 : UINT_PTR (+64, 4byte)  st.16 = 値  /  値 = st.16   (lpoke/lpeek も可)
; dwReserved3 : UINT_PTR (+68, 4byte)  st.17 = 値  /  値 = st.17   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DDVIDEOPORTDESC サイズ: 88 バイト(x64)
dim st, 22    ; 4byte整数×22(構造体サイズ 88 / 4 切り上げ)
; dwSize : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; dwFieldWidth : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; dwVBIWidth : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; dwFieldHeight : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; dwMicrosecondsPerField : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; dwMaxPixelsPerSecond : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; dwVideoPortID : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; dwReserved1 : DWORD (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; VideoPortType : DDVIDEOPORTCONNECT (+32, 40byte)  varptr(st)+32 を基点に操作(40byte:入れ子/配列)
; dwReserved2 : UINT_PTR (+72, 8byte)  qpoke st,72,値 / qpeek(st,72)  ※IronHSPのみ。3.7/3.8は lpoke st,72,下位 : lpoke st,76,上位
; dwReserved3 : UINT_PTR (+80, 8byte)  qpoke st,80,値 / qpeek(st,80)  ※IronHSPのみ。3.7/3.8は lpoke st,80,下位 : lpoke st,84,上位
; ※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 DDVIDEOPORTCONNECT
    #field int dwSize
    #field int dwPortWidth
    #field GUID guidTypeID
    #field int dwFlags
    #field intptr dwReserved1
#endstruct

#defstruct global DDVIDEOPORTDESC
    #field int dwSize
    #field int dwFieldWidth
    #field int dwVBIWidth
    #field int dwFieldHeight
    #field int dwMicrosecondsPerField
    #field int dwMaxPixelsPerSecond
    #field int dwVideoPortID
    #field int dwReserved1
    #field DDVIDEOPORTCONNECT VideoPortType
    #field intptr dwReserved2
    #field intptr dwReserved3
#endstruct

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