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

DDSTEREOMODE

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

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

フィールド

フィールドサイズx64x86説明
dwSizeDWORD4+0+0構造体サイズ(バイト数)。呼び出し前に設定する。
dwHeightDWORD4+4+4ステレオモードの高さ(ピクセル)を示す。
dwWidthDWORD4+8+8ステレオモードの幅(ピクセル)を示す。
dwBppDWORD4+12+121ピクセルあたりのビット数を示す。
dwRefreshRateDWORD4+16+16リフレッシュレート(Hz)を示す。
bSupportedBOOL4+20+20このステレオモードが対応されているかを示す真偽値。

各言語での定義

#include <windows.h>

// DDSTEREOMODE  (x64 24 / x86 24 バイト)
typedef struct DDSTEREOMODE {
    DWORD dwSize;
    DWORD dwHeight;
    DWORD dwWidth;
    DWORD dwBpp;
    DWORD dwRefreshRate;
    BOOL bSupported;
} DDSTEREOMODE;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DDSTEREOMODE
{
    public uint dwSize;
    public uint dwHeight;
    public uint dwWidth;
    public uint dwBpp;
    public uint dwRefreshRate;
    [MarshalAs(UnmanagedType.Bool)] public bool bSupported;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DDSTEREOMODE
    Public dwSize As UInteger
    Public dwHeight As UInteger
    Public dwWidth As UInteger
    Public dwBpp As UInteger
    Public dwRefreshRate As UInteger
    <MarshalAs(UnmanagedType.Bool)> Public bSupported As Boolean
End Structure
import ctypes
from ctypes import wintypes

class DDSTEREOMODE(ctypes.Structure):
    _fields_ = [
        ("dwSize", wintypes.DWORD),
        ("dwHeight", wintypes.DWORD),
        ("dwWidth", wintypes.DWORD),
        ("dwBpp", wintypes.DWORD),
        ("dwRefreshRate", wintypes.DWORD),
        ("bSupported", wintypes.BOOL),
    ]
#[repr(C)]
pub struct DDSTEREOMODE {
    pub dwSize: u32,
    pub dwHeight: u32,
    pub dwWidth: u32,
    pub dwBpp: u32,
    pub dwRefreshRate: u32,
    pub bSupported: i32,
}
import "golang.org/x/sys/windows"

type DDSTEREOMODE struct {
	dwSize uint32
	dwHeight uint32
	dwWidth uint32
	dwBpp uint32
	dwRefreshRate uint32
	bSupported int32
}
type
  DDSTEREOMODE = record
    dwSize: DWORD;
    dwHeight: DWORD;
    dwWidth: DWORD;
    dwBpp: DWORD;
    dwRefreshRate: DWORD;
    bSupported: BOOL;
  end;
const DDSTEREOMODE = extern struct {
    dwSize: u32,
    dwHeight: u32,
    dwWidth: u32,
    dwBpp: u32,
    dwRefreshRate: u32,
    bSupported: i32,
};
type
  DDSTEREOMODE {.bycopy.} = object
    dwSize: uint32
    dwHeight: uint32
    dwWidth: uint32
    dwBpp: uint32
    dwRefreshRate: uint32
    bSupported: int32
struct DDSTEREOMODE
{
    uint dwSize;
    uint dwHeight;
    uint dwWidth;
    uint dwBpp;
    uint dwRefreshRate;
    int bSupported;
}

HSP用 定義

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

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

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