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

DCIENUMINPUT

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

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

フィールド

フィールドサイズx64x86説明
cmdDCICMD20+0+0DCIコマンド情報を保持するDCICMD。
rSrcRECT16+20+20列挙対象のソース矩形(RECT)。
rDstRECT16+36+36列挙対象のデスティネーション矩形(RECT)。
EnumCallbackINT_PTR8/4+56+52列挙中に呼ばれるコールバック関数のアドレス。
lpContextvoid*8/4+64+56コールバックに渡される任意のコンテキストポインタ。

各言語での定義

#include <windows.h>

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

// RECT  (x64 16 / x86 16 バイト)
typedef struct RECT {
    INT left;
    INT top;
    INT right;
    INT bottom;
} RECT;

// DCIENUMINPUT  (x64 72 / x86 60 バイト)
typedef struct DCIENUMINPUT {
    DCICMD cmd;
    RECT rSrc;
    RECT rDst;
    INT_PTR EnumCallback;
    void* lpContext;
} DCIENUMINPUT;
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 RECT
{
    public int left;
    public int top;
    public int right;
    public int bottom;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DCIENUMINPUT
{
    public DCICMD cmd;
    public RECT rSrc;
    public RECT rDst;
    public IntPtr EnumCallback;
    public IntPtr lpContext;
}
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 RECT
    Public left As Integer
    Public top As Integer
    Public right As Integer
    Public bottom As Integer
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DCIENUMINPUT
    Public cmd As DCICMD
    Public rSrc As RECT
    Public rDst As RECT
    Public EnumCallback As IntPtr
    Public lpContext 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 RECT(ctypes.Structure):
    _fields_ = [
        ("left", ctypes.c_int),
        ("top", ctypes.c_int),
        ("right", ctypes.c_int),
        ("bottom", ctypes.c_int),
    ]

class DCIENUMINPUT(ctypes.Structure):
    _fields_ = [
        ("cmd", DCICMD),
        ("rSrc", RECT),
        ("rDst", RECT),
        ("EnumCallback", ctypes.c_ssize_t),
        ("lpContext", 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 RECT {
    pub left: i32,
    pub top: i32,
    pub right: i32,
    pub bottom: i32,
}

#[repr(C)]
pub struct DCIENUMINPUT {
    pub cmd: DCICMD,
    pub rSrc: RECT,
    pub rDst: RECT,
    pub EnumCallback: isize,
    pub lpContext: *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 RECT struct {
	left int32
	top int32
	right int32
	bottom int32
}

type DCIENUMINPUT struct {
	cmd DCICMD
	rSrc RECT
	rDst RECT
	EnumCallback uintptr
	lpContext uintptr
}
type
  DCICMD = record
    dwCommand: DWORD;
    dwParam1: DWORD;
    dwParam2: DWORD;
    dwVersion: DWORD;
    dwReserved: DWORD;
  end;

  RECT = record
    left: Integer;
    top: Integer;
    right: Integer;
    bottom: Integer;
  end;

  DCIENUMINPUT = record
    cmd: DCICMD;
    rSrc: RECT;
    rDst: RECT;
    EnumCallback: NativeInt;
    lpContext: Pointer;
  end;
const DCICMD = extern struct {
    dwCommand: u32,
    dwParam1: u32,
    dwParam2: u32,
    dwVersion: u32,
    dwReserved: u32,
};

const RECT = extern struct {
    left: i32,
    top: i32,
    right: i32,
    bottom: i32,
};

const DCIENUMINPUT = extern struct {
    cmd: DCICMD,
    rSrc: RECT,
    rDst: RECT,
    EnumCallback: isize,
    lpContext: ?*anyopaque,
};
type
  DCICMD {.bycopy.} = object
    dwCommand: uint32
    dwParam1: uint32
    dwParam2: uint32
    dwVersion: uint32
    dwReserved: uint32

  RECT {.bycopy.} = object
    left: int32
    top: int32
    right: int32
    bottom: int32

  DCIENUMINPUT {.bycopy.} = object
    cmd: DCICMD
    rSrc: RECT
    rDst: RECT
    EnumCallback: int
    lpContext: pointer
struct DCICMD
{
    uint dwCommand;
    uint dwParam1;
    uint dwParam2;
    uint dwVersion;
    uint dwReserved;
}

struct RECT
{
    int left;
    int top;
    int right;
    int bottom;
}

struct DCIENUMINPUT
{
    DCICMD cmd;
    RECT rSrc;
    RECT rDst;
    ptrdiff_t EnumCallback;
    void* lpContext;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; DCIENUMINPUT サイズ: 60 バイト(x86)
dim st, 15    ; 4byte整数×15(構造体サイズ 60 / 4 切り上げ)
; cmd : DCICMD (+0, 20byte)  varptr(st)+0 を基点に操作(20byte:入れ子/配列)
; rSrc : RECT (+20, 16byte)  varptr(st)+20 を基点に操作(16byte:入れ子/配列)
; rDst : RECT (+36, 16byte)  varptr(st)+36 を基点に操作(16byte:入れ子/配列)
; EnumCallback : INT_PTR (+52, 4byte)  st.13 = 値  /  値 = st.13   (lpoke/lpeek も可)
; lpContext : void* (+56, 4byte)  st.14 = 値  /  値 = st.14   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DCIENUMINPUT サイズ: 72 バイト(x64)
dim st, 18    ; 4byte整数×18(構造体サイズ 72 / 4 切り上げ)
; cmd : DCICMD (+0, 20byte)  varptr(st)+0 を基点に操作(20byte:入れ子/配列)
; rSrc : RECT (+20, 16byte)  varptr(st)+20 を基点に操作(16byte:入れ子/配列)
; rDst : RECT (+36, 16byte)  varptr(st)+36 を基点に操作(16byte:入れ子/配列)
; EnumCallback : INT_PTR (+56, 8byte)  qpoke st,56,値 / qpeek(st,56)  ※IronHSPのみ。3.7/3.8は lpoke st,56,下位 : lpoke st,60,上位
; lpContext : void* (+64, 8byte)  qpoke st,64,値 / qpeek(st,64)  ※IronHSPのみ。3.7/3.8は lpoke st,64,下位 : lpoke st,68,上位
; ※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 RECT
    #field int left
    #field int top
    #field int right
    #field int bottom
#endstruct

#defstruct global DCIENUMINPUT
    #field DCICMD cmd
    #field RECT rSrc
    #field RECT rDst
    #field intptr EnumCallback
    #field intptr lpContext
#endstruct

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