Win32 API 日本語リファレンス
ホームSystem.WindowsProgramming › DCICREATEINPUT

DCICREATEINPUT

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

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

フィールド

フィールドサイズx64x86説明
cmdDCICMD20+0+0DCIコマンド情報を保持するDCICMD。
dwCompressionDWORD4+20+20サーフェスの圧縮形式を示すFOURCCコード。
dwMaskDWORD12+24+24RGBのカラーマスク配列。ピクセル形式を示す。
dwWidthDWORD4+36+36サーフェスの幅(ピクセル)。
dwHeightDWORD4+40+40サーフェスの高さ(ピクセル)。
dwDCICapsDWORD4+44+44要求するDCIケイパビリティのフラグ。
dwBitCountDWORD4+48+481ピクセルあたりのビット数。
lpSurfacevoid*8/4+56+52作成されたサーフェスへのポインタ。

各言語での定義

#include <windows.h>

// DCICMD  (x64 20 / x86 20 バイト)
typedef struct DCICMD {
    DWORD dwCommand;
    DWORD dwParam1;
    DWORD dwParam2;
    DWORD dwVersion;
    DWORD dwReserved;
} DCICMD;

// DCICREATEINPUT  (x64 64 / x86 56 バイト)
typedef struct DCICREATEINPUT {
    DCICMD cmd;
    DWORD dwCompression;
    DWORD dwMask[3];
    DWORD dwWidth;
    DWORD dwHeight;
    DWORD dwDCICaps;
    DWORD dwBitCount;
    void* lpSurface;
} DCICREATEINPUT;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DCICMD
{
    public uint dwCommand;
    public uint dwParam1;
    public uint dwParam2;
    public uint dwVersion;
    public uint dwReserved;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DCICREATEINPUT
{
    public DCICMD cmd;
    public uint dwCompression;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public uint[] dwMask;
    public uint dwWidth;
    public uint dwHeight;
    public uint dwDCICaps;
    public uint dwBitCount;
    public IntPtr lpSurface;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DCICMD
    Public dwCommand As UInteger
    Public dwParam1 As UInteger
    Public dwParam2 As UInteger
    Public dwVersion As UInteger
    Public dwReserved As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DCICREATEINPUT
    Public cmd As DCICMD
    Public dwCompression As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=3)> Public dwMask() As UInteger
    Public dwWidth As UInteger
    Public dwHeight As UInteger
    Public dwDCICaps As UInteger
    Public dwBitCount As UInteger
    Public lpSurface As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class DCICMD(ctypes.Structure):
    _fields_ = [
        ("dwCommand", wintypes.DWORD),
        ("dwParam1", wintypes.DWORD),
        ("dwParam2", wintypes.DWORD),
        ("dwVersion", wintypes.DWORD),
        ("dwReserved", wintypes.DWORD),
    ]

class DCICREATEINPUT(ctypes.Structure):
    _fields_ = [
        ("cmd", DCICMD),
        ("dwCompression", wintypes.DWORD),
        ("dwMask", wintypes.DWORD * 3),
        ("dwWidth", wintypes.DWORD),
        ("dwHeight", wintypes.DWORD),
        ("dwDCICaps", wintypes.DWORD),
        ("dwBitCount", wintypes.DWORD),
        ("lpSurface", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct DCICMD {
    pub dwCommand: u32,
    pub dwParam1: u32,
    pub dwParam2: u32,
    pub dwVersion: u32,
    pub dwReserved: u32,
}

#[repr(C)]
pub struct DCICREATEINPUT {
    pub cmd: DCICMD,
    pub dwCompression: u32,
    pub dwMask: [u32; 3],
    pub dwWidth: u32,
    pub dwHeight: u32,
    pub dwDCICaps: u32,
    pub dwBitCount: u32,
    pub lpSurface: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type DCICMD struct {
	dwCommand uint32
	dwParam1 uint32
	dwParam2 uint32
	dwVersion uint32
	dwReserved uint32
}

type DCICREATEINPUT struct {
	cmd DCICMD
	dwCompression uint32
	dwMask [3]uint32
	dwWidth uint32
	dwHeight uint32
	dwDCICaps uint32
	dwBitCount uint32
	lpSurface uintptr
}
type
  DCICMD = record
    dwCommand: DWORD;
    dwParam1: DWORD;
    dwParam2: DWORD;
    dwVersion: DWORD;
    dwReserved: DWORD;
  end;

  DCICREATEINPUT = record
    cmd: DCICMD;
    dwCompression: DWORD;
    dwMask: array[0..2] of DWORD;
    dwWidth: DWORD;
    dwHeight: DWORD;
    dwDCICaps: DWORD;
    dwBitCount: DWORD;
    lpSurface: Pointer;
  end;
const DCICMD = extern struct {
    dwCommand: u32,
    dwParam1: u32,
    dwParam2: u32,
    dwVersion: u32,
    dwReserved: u32,
};

const DCICREATEINPUT = extern struct {
    cmd: DCICMD,
    dwCompression: u32,
    dwMask: [3]u32,
    dwWidth: u32,
    dwHeight: u32,
    dwDCICaps: u32,
    dwBitCount: u32,
    lpSurface: ?*anyopaque,
};
type
  DCICMD {.bycopy.} = object
    dwCommand: uint32
    dwParam1: uint32
    dwParam2: uint32
    dwVersion: uint32
    dwReserved: uint32

  DCICREATEINPUT {.bycopy.} = object
    cmd: DCICMD
    dwCompression: uint32
    dwMask: array[3, uint32]
    dwWidth: uint32
    dwHeight: uint32
    dwDCICaps: uint32
    dwBitCount: uint32
    lpSurface: pointer
struct DCICMD
{
    uint dwCommand;
    uint dwParam1;
    uint dwParam2;
    uint dwVersion;
    uint dwReserved;
}

struct DCICREATEINPUT
{
    DCICMD cmd;
    uint dwCompression;
    uint[3] dwMask;
    uint dwWidth;
    uint dwHeight;
    uint dwDCICaps;
    uint dwBitCount;
    void* lpSurface;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; DCICREATEINPUT サイズ: 56 バイト(x86)
dim st, 14    ; 4byte整数×14(構造体サイズ 56 / 4 切り上げ)
; cmd : DCICMD (+0, 20byte)  varptr(st)+0 を基点に操作(20byte:入れ子/配列)
; dwCompression : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; dwMask : DWORD (+24, 12byte)  varptr(st)+24 を基点に操作(12byte:入れ子/配列)
; dwWidth : DWORD (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; dwHeight : DWORD (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; dwDCICaps : DWORD (+44, 4byte)  st.11 = 値  /  値 = st.11   (lpoke/lpeek も可)
; dwBitCount : DWORD (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; lpSurface : void* (+52, 4byte)  st.13 = 値  /  値 = st.13   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DCICREATEINPUT サイズ: 64 バイト(x64)
dim st, 16    ; 4byte整数×16(構造体サイズ 64 / 4 切り上げ)
; cmd : DCICMD (+0, 20byte)  varptr(st)+0 を基点に操作(20byte:入れ子/配列)
; dwCompression : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; dwMask : DWORD (+24, 12byte)  varptr(st)+24 を基点に操作(12byte:入れ子/配列)
; dwWidth : DWORD (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; dwHeight : DWORD (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; dwDCICaps : DWORD (+44, 4byte)  st.11 = 値  /  値 = st.11   (lpoke/lpeek も可)
; dwBitCount : DWORD (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; lpSurface : void* (+56, 8byte)  qpoke st,56,値 / qpeek(st,56)  ※IronHSPのみ。3.7/3.8は lpoke st,56,下位 : lpoke st,60,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global DCICMD
    #field int dwCommand
    #field int dwParam1
    #field int dwParam2
    #field int dwVersion
    #field int dwReserved
#endstruct

#defstruct global DCICREATEINPUT
    #field DCICMD cmd
    #field int dwCompression
    #field int dwMask 3
    #field int dwWidth
    #field int dwHeight
    #field int dwDCICaps
    #field int dwBitCount
    #field intptr lpSurface
#endstruct

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