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

DD_GETMOCOMPFORMATSDATA

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

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

フィールド

フィールドサイズx64x86説明
lpDDDD_DIRECTDRAW_LOCAL*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。

各言語での定義

#include <windows.h>

// DD_GETMOCOMPFORMATSDATA  (x64 40 / x86 20 バイト)
typedef struct DD_GETMOCOMPFORMATSDATA {
    DD_DIRECTDRAW_LOCAL* lpDD;
    GUID* lpGuid;
    DWORD dwNumFormats;
    DDPIXELFORMAT* lpFormats;
    HRESULT ddRVal;
} DD_GETMOCOMPFORMATSDATA;
using System;
using System.Runtime.InteropServices;

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

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

class DD_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),
    ]
#[repr(C)]
pub struct DD_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,
}
import "golang.org/x/sys/windows"

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

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; DD_GETMOCOMPFORMATSDATA サイズ: 20 バイト(x86)
dim st, 5    ; 4byte整数×5(構造体サイズ 20 / 4 切り上げ)
; lpDD : DD_DIRECTDRAW_LOCAL* (+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 も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DD_GETMOCOMPFORMATSDATA サイズ: 40 バイト(x64)
dim st, 10    ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; lpDD : DD_DIRECTDRAW_LOCAL* (+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 も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DD_GETMOCOMPFORMATSDATA
    #field intptr lpDD
    #field intptr lpGuid
    #field int dwNumFormats
    #field intptr lpFormats
    #field int ddRVal
#endstruct

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