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

D3DDISPLAYMODEEX

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

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

フィールド

フィールドサイズx64x86説明
SizeDWORD4+0+0本構造体のサイズ(バイト単位)。呼び出し前に設定する。
WidthDWORD4+4+4画面の幅(ピクセル単位)。
HeightDWORD4+8+8画面の高さ(ピクセル単位)。
RefreshRateDWORD4+12+12リフレッシュレート(Hz)。
FormatD3DFORMAT4+16+16ピクセル形式を示すD3DFORMAT。
ScanLineOrderingD3DSCANLINEORDERING4+20+20走査方式を示すD3DSCANLINEORDERING(プログレッシブ/インターレース)。

各言語での定義

#include <windows.h>

// D3DDISPLAYMODEEX  (x64 24 / x86 24 バイト)
typedef struct D3DDISPLAYMODEEX {
    DWORD Size;
    DWORD Width;
    DWORD Height;
    DWORD RefreshRate;
    D3DFORMAT Format;
    D3DSCANLINEORDERING ScanLineOrdering;
} D3DDISPLAYMODEEX;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3DDISPLAYMODEEX
{
    public uint Size;
    public uint Width;
    public uint Height;
    public uint RefreshRate;
    public uint Format;
    public int ScanLineOrdering;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3DDISPLAYMODEEX
    Public Size As UInteger
    Public Width As UInteger
    Public Height As UInteger
    Public RefreshRate As UInteger
    Public Format As UInteger
    Public ScanLineOrdering As Integer
End Structure
import ctypes
from ctypes import wintypes

class D3DDISPLAYMODEEX(ctypes.Structure):
    _fields_ = [
        ("Size", wintypes.DWORD),
        ("Width", wintypes.DWORD),
        ("Height", wintypes.DWORD),
        ("RefreshRate", wintypes.DWORD),
        ("Format", wintypes.DWORD),
        ("ScanLineOrdering", ctypes.c_int),
    ]
#[repr(C)]
pub struct D3DDISPLAYMODEEX {
    pub Size: u32,
    pub Width: u32,
    pub Height: u32,
    pub RefreshRate: u32,
    pub Format: u32,
    pub ScanLineOrdering: i32,
}
import "golang.org/x/sys/windows"

type D3DDISPLAYMODEEX struct {
	Size uint32
	Width uint32
	Height uint32
	RefreshRate uint32
	Format uint32
	ScanLineOrdering int32
}
type
  D3DDISPLAYMODEEX = record
    Size: DWORD;
    Width: DWORD;
    Height: DWORD;
    RefreshRate: DWORD;
    Format: DWORD;
    ScanLineOrdering: Integer;
  end;
const D3DDISPLAYMODEEX = extern struct {
    Size: u32,
    Width: u32,
    Height: u32,
    RefreshRate: u32,
    Format: u32,
    ScanLineOrdering: i32,
};
type
  D3DDISPLAYMODEEX {.bycopy.} = object
    Size: uint32
    Width: uint32
    Height: uint32
    RefreshRate: uint32
    Format: uint32
    ScanLineOrdering: int32
struct D3DDISPLAYMODEEX
{
    uint Size;
    uint Width;
    uint Height;
    uint RefreshRate;
    uint Format;
    int ScanLineOrdering;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; D3DDISPLAYMODEEX サイズ: 24 バイト(x64)
dim st, 6    ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; Size : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; Width : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; Height : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; RefreshRate : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; Format : D3DFORMAT (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; ScanLineOrdering : D3DSCANLINEORDERING (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global D3DDISPLAYMODEEX
    #field int Size
    #field int Width
    #field int Height
    #field int RefreshRate
    #field int Format
    #field int ScanLineOrdering
#endstruct

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