ホーム › Graphics.DirectDraw › DDVIDEOPORTSTATUS
DDVIDEOPORTSTATUS
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| dwSize | DWORD | 4 | +0 | +0 | 構造体サイズ(バイト数)。呼び出し前に設定する。 |
| bInUse | BOOL | 4 | +4 | +4 | ビデオポートが使用中かを示す真偽値。 |
| dwFlags | DWORD | 4 | +8 | +8 | 状態を示すフラグ。現在は予約で0とする。 |
| dwReserved1 | DWORD | 4 | +12 | +12 | 予約フィールド。0とする。 |
| VideoPortType | DDVIDEOPORTCONNECT | 40/32 | +16 | +16 | 使用中ポートの接続タイプ(DDVIDEOPORTCONNECT)。 |
| dwReserved2 | UINT_PTR | 8/4 | +56 | +48 | 予約フィールド。0とする。 |
| dwReserved3 | UINT_PTR | 8/4 | +64 | +52 | 予約フィールド。0とする。 |
各言語での定義
#include <windows.h>
// DDVIDEOPORTCONNECT (x64 40 / x86 32 バイト)
typedef struct DDVIDEOPORTCONNECT {
DWORD dwSize;
DWORD dwPortWidth;
GUID guidTypeID;
DWORD dwFlags;
UINT_PTR dwReserved1;
} DDVIDEOPORTCONNECT;
// DDVIDEOPORTSTATUS (x64 72 / x86 56 バイト)
typedef struct DDVIDEOPORTSTATUS {
DWORD dwSize;
BOOL bInUse;
DWORD dwFlags;
DWORD dwReserved1;
DDVIDEOPORTCONNECT VideoPortType;
UINT_PTR dwReserved2;
UINT_PTR dwReserved3;
} DDVIDEOPORTSTATUS;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 DDVIDEOPORTSTATUS
{
public uint dwSize;
[MarshalAs(UnmanagedType.Bool)] public bool bInUse;
public uint dwFlags;
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 DDVIDEOPORTSTATUS
Public dwSize As UInteger
<MarshalAs(UnmanagedType.Bool)> Public bInUse As Boolean
Public dwFlags As UInteger
Public dwReserved1 As UInteger
Public VideoPortType As DDVIDEOPORTCONNECT
Public dwReserved2 As UIntPtr
Public dwReserved3 As UIntPtr
End Structureimport 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 DDVIDEOPORTSTATUS(ctypes.Structure):
_fields_ = [
("dwSize", wintypes.DWORD),
("bInUse", wintypes.BOOL),
("dwFlags", 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 DDVIDEOPORTSTATUS {
pub dwSize: u32,
pub bInUse: i32,
pub dwFlags: 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 DDVIDEOPORTSTATUS struct {
dwSize uint32
bInUse int32
dwFlags uint32
dwReserved1 uint32
VideoPortType DDVIDEOPORTCONNECT
dwReserved2 uintptr
dwReserved3 uintptr
}type
DDVIDEOPORTCONNECT = record
dwSize: DWORD;
dwPortWidth: DWORD;
guidTypeID: TGUID;
dwFlags: DWORD;
dwReserved1: NativeUInt;
end;
DDVIDEOPORTSTATUS = record
dwSize: DWORD;
bInUse: BOOL;
dwFlags: 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 DDVIDEOPORTSTATUS = extern struct {
dwSize: u32,
bInUse: i32,
dwFlags: u32,
dwReserved1: u32,
VideoPortType: DDVIDEOPORTCONNECT,
dwReserved2: usize,
dwReserved3: usize,
};type
DDVIDEOPORTCONNECT {.bycopy.} = object
dwSize: uint32
dwPortWidth: uint32
guidTypeID: GUID
dwFlags: uint32
dwReserved1: uint
DDVIDEOPORTSTATUS {.bycopy.} = object
dwSize: uint32
bInUse: int32
dwFlags: uint32
dwReserved1: uint32
VideoPortType: DDVIDEOPORTCONNECT
dwReserved2: uint
dwReserved3: uintstruct DDVIDEOPORTCONNECT
{
uint dwSize;
uint dwPortWidth;
GUID guidTypeID;
uint dwFlags;
size_t dwReserved1;
}
struct DDVIDEOPORTSTATUS
{
uint dwSize;
int bInUse;
uint dwFlags;
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 レイアウト)
; DDVIDEOPORTSTATUS サイズ: 56 バイト(x86)
dim st, 14 ; 4byte整数×14(構造体サイズ 56 / 4 切り上げ)
; dwSize : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; bInUse : BOOL (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; dwFlags : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; dwReserved1 : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; VideoPortType : DDVIDEOPORTCONNECT (+16, 32byte) varptr(st)+16 を基点に操作(32byte:入れ子/配列)
; dwReserved2 : UINT_PTR (+48, 4byte) st.12 = 値 / 値 = st.12 (lpoke/lpeek も可)
; dwReserved3 : UINT_PTR (+52, 4byte) st.13 = 値 / 値 = st.13 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DDVIDEOPORTSTATUS サイズ: 72 バイト(x64)
dim st, 18 ; 4byte整数×18(構造体サイズ 72 / 4 切り上げ)
; dwSize : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; bInUse : BOOL (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; dwFlags : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; dwReserved1 : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; VideoPortType : DDVIDEOPORTCONNECT (+16, 40byte) varptr(st)+16 を基点に操作(40byte:入れ子/配列)
; dwReserved2 : UINT_PTR (+56, 8byte) qpoke st,56,値 / qpeek(st,56) ※IronHSPのみ。3.7/3.8は lpoke st,56,下位 : lpoke st,60,上位
; dwReserved3 : UINT_PTR (+64, 8byte) qpoke st,64,値 / qpeek(st,64) ※IronHSPのみ。3.7/3.8は lpoke st,64,下位 : lpoke st,68,上位
; ※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 DDVIDEOPORTSTATUS
#field int dwSize
#field bool bInUse
#field int dwFlags
#field int dwReserved1
#field DDVIDEOPORTCONNECT VideoPortType
#field intptr dwReserved2
#field intptr dwReserved3
#endstruct
stdim st, DDVIDEOPORTSTATUS ; NSTRUCT 変数を確保
st->dwSize = 100
mes "dwSize=" + st->dwSize