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

DDHAL_GETMOCOMPFORMATSDATA

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

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

フィールド

フィールドサイズx64x86説明
lpDDDDRAWI_DIRECTDRAW_LCL*8/4+0+0対象のDirectDrawローカルオブジェクトへのポインタ。
lpGuidGUID*8/4+8+4対象とするモーション補償方式のGUIDへのポインタ。
dwNumFormatsDWORD4+16+8対応する非圧縮ピクセル形式の個数。入出力兼用。
lpFormatsDDPIXELFORMAT*8/4+24+12対応ピクセル形式の配列を受け取るバッファへのポインタ。NULL可で個数取得に用いる。
ddRValHRESULT4+32+16操作の結果を示すHRESULT。成功時はDD_OK。
GetMoCompFormatsLPDDHALMOCOMPCB_GETFORMATS8/4+40+20対応ピクセル形式を取得するコールバック関数へのポインタ。

各言語での定義

#include <windows.h>

// DDHAL_GETMOCOMPFORMATSDATA  (x64 48 / x86 24 バイト)
typedef struct DDHAL_GETMOCOMPFORMATSDATA {
    DDRAWI_DIRECTDRAW_LCL* lpDD;
    GUID* lpGuid;
    DWORD dwNumFormats;
    DDPIXELFORMAT* lpFormats;
    HRESULT ddRVal;
    LPDDHALMOCOMPCB_GETFORMATS GetMoCompFormats;
} DDHAL_GETMOCOMPFORMATSDATA;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DDHAL_GETMOCOMPFORMATSDATA
{
    public IntPtr lpDD;
    public IntPtr lpGuid;
    public uint dwNumFormats;
    public IntPtr lpFormats;
    public int ddRVal;
    public IntPtr GetMoCompFormats;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DDHAL_GETMOCOMPFORMATSDATA
    Public lpDD As IntPtr
    Public lpGuid As IntPtr
    Public dwNumFormats As UInteger
    Public lpFormats As IntPtr
    Public ddRVal As Integer
    Public GetMoCompFormats As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class DDHAL_GETMOCOMPFORMATSDATA(ctypes.Structure):
    _fields_ = [
        ("lpDD", ctypes.c_void_p),
        ("lpGuid", ctypes.c_void_p),
        ("dwNumFormats", wintypes.DWORD),
        ("lpFormats", ctypes.c_void_p),
        ("ddRVal", ctypes.c_int),
        ("GetMoCompFormats", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct DDHAL_GETMOCOMPFORMATSDATA {
    pub lpDD: *mut core::ffi::c_void,
    pub lpGuid: *mut core::ffi::c_void,
    pub dwNumFormats: u32,
    pub lpFormats: *mut core::ffi::c_void,
    pub ddRVal: i32,
    pub GetMoCompFormats: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type DDHAL_GETMOCOMPFORMATSDATA struct {
	lpDD uintptr
	lpGuid uintptr
	dwNumFormats uint32
	lpFormats uintptr
	ddRVal int32
	GetMoCompFormats uintptr
}
type
  DDHAL_GETMOCOMPFORMATSDATA = record
    lpDD: Pointer;
    lpGuid: Pointer;
    dwNumFormats: DWORD;
    lpFormats: Pointer;
    ddRVal: Integer;
    GetMoCompFormats: Pointer;
  end;
const DDHAL_GETMOCOMPFORMATSDATA = extern struct {
    lpDD: ?*anyopaque,
    lpGuid: ?*anyopaque,
    dwNumFormats: u32,
    lpFormats: ?*anyopaque,
    ddRVal: i32,
    GetMoCompFormats: ?*anyopaque,
};
type
  DDHAL_GETMOCOMPFORMATSDATA {.bycopy.} = object
    lpDD: pointer
    lpGuid: pointer
    dwNumFormats: uint32
    lpFormats: pointer
    ddRVal: int32
    GetMoCompFormats: pointer
struct DDHAL_GETMOCOMPFORMATSDATA
{
    void* lpDD;
    void* lpGuid;
    uint dwNumFormats;
    void* lpFormats;
    int ddRVal;
    void* GetMoCompFormats;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; DDHAL_GETMOCOMPFORMATSDATA サイズ: 24 バイト(x86)
dim st, 6    ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; lpDD : DDRAWI_DIRECTDRAW_LCL* (+0, 4byte)  varptr(st)+0 を基点に操作(4byte:入れ子/配列)
; lpGuid : GUID* (+4, 4byte)  varptr(st)+4 を基点に操作(4byte:入れ子/配列)
; dwNumFormats : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; lpFormats : DDPIXELFORMAT* (+12, 4byte)  varptr(st)+12 を基点に操作(4byte:入れ子/配列)
; ddRVal : HRESULT (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; GetMoCompFormats : LPDDHALMOCOMPCB_GETFORMATS (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DDHAL_GETMOCOMPFORMATSDATA サイズ: 48 バイト(x64)
dim st, 12    ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; lpDD : DDRAWI_DIRECTDRAW_LCL* (+0, 8byte)  varptr(st)+0 を基点に操作(8byte:入れ子/配列)
; lpGuid : GUID* (+8, 8byte)  varptr(st)+8 を基点に操作(8byte:入れ子/配列)
; dwNumFormats : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; lpFormats : DDPIXELFORMAT* (+24, 8byte)  varptr(st)+24 を基点に操作(8byte:入れ子/配列)
; ddRVal : HRESULT (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; GetMoCompFormats : LPDDHALMOCOMPCB_GETFORMATS (+40, 8byte)  qpoke st,40,値 / qpeek(st,40)  ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DDHAL_GETMOCOMPFORMATSDATA
    #field intptr lpDD
    #field intptr lpGuid
    #field int dwNumFormats
    #field intptr lpFormats
    #field int ddRVal
    #field intptr GetMoCompFormats
#endstruct

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