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

DCIEnum

関数
DCIサーフェスを列挙してコールバックを呼び出す。
DLLDCIMAN32.dll呼出規約winapi

シグネチャ

// DCIMAN32.dll
#include <windows.h>

INT DCIEnum(
    HDC hdc,
    RECT* lprDst,
    RECT* lprSrc,
    void* lpFnCallback,
    void* lpContext
);

パラメーター

名前方向
hdcHDCin
lprDstRECT*inout
lprSrcRECT*inout
lpFnCallbackvoid*inout
lpContextvoid*inout

戻り値の型: INT

各言語での呼び出し定義

// DCIMAN32.dll
#include <windows.h>

INT DCIEnum(
    HDC hdc,
    RECT* lprDst,
    RECT* lprSrc,
    void* lpFnCallback,
    void* lpContext
);
[DllImport("DCIMAN32.dll", ExactSpelling = true)]
static extern int DCIEnum(
    IntPtr hdc,   // HDC
    IntPtr lprDst,   // RECT* in/out
    IntPtr lprSrc,   // RECT* in/out
    IntPtr lpFnCallback,   // void* in/out
    IntPtr lpContext   // void* in/out
);
<DllImport("DCIMAN32.dll", ExactSpelling:=True)>
Public Shared Function DCIEnum(
    hdc As IntPtr,   ' HDC
    lprDst As IntPtr,   ' RECT* in/out
    lprSrc As IntPtr,   ' RECT* in/out
    lpFnCallback As IntPtr,   ' void* in/out
    lpContext As IntPtr   ' void* in/out
) As Integer
End Function
' hdc : HDC
' lprDst : RECT* in/out
' lprSrc : RECT* in/out
' lpFnCallback : void* in/out
' lpContext : void* in/out
Declare PtrSafe Function DCIEnum Lib "dciman32" ( _
    ByVal hdc As LongPtr, _
    ByVal lprDst As LongPtr, _
    ByVal lprSrc As LongPtr, _
    ByVal lpFnCallback As LongPtr, _
    ByVal lpContext As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

DCIEnum = ctypes.windll.dciman32.DCIEnum
DCIEnum.restype = ctypes.c_int
DCIEnum.argtypes = [
    wintypes.HANDLE,  # hdc : HDC
    ctypes.c_void_p,  # lprDst : RECT* in/out
    ctypes.c_void_p,  # lprSrc : RECT* in/out
    ctypes.POINTER(None),  # lpFnCallback : void* in/out
    ctypes.POINTER(None),  # lpContext : void* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('DCIMAN32.dll')
DCIEnum = Fiddle::Function.new(
  lib['DCIEnum'],
  [
    Fiddle::TYPE_VOIDP,  # hdc : HDC
    Fiddle::TYPE_VOIDP,  # lprDst : RECT* in/out
    Fiddle::TYPE_VOIDP,  # lprSrc : RECT* in/out
    Fiddle::TYPE_VOIDP,  # lpFnCallback : void* in/out
    Fiddle::TYPE_VOIDP,  # lpContext : void* in/out
  ],
  Fiddle::TYPE_INT)
#[link(name = "dciman32")]
extern "system" {
    fn DCIEnum(
        hdc: *mut core::ffi::c_void,  // HDC
        lprDst: *mut RECT,  // RECT* in/out
        lprSrc: *mut RECT,  // RECT* in/out
        lpFnCallback: *mut (),  // void* in/out
        lpContext: *mut ()  // void* in/out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("DCIMAN32.dll")]
public static extern int DCIEnum(IntPtr hdc, IntPtr lprDst, IntPtr lprSrc, IntPtr lpFnCallback, IntPtr lpContext);
"@
$api = Add-Type -MemberDefinition $sig -Name 'DCIMAN32_DCIEnum' -Namespace Win32 -PassThru
# $api::DCIEnum(hdc, lprDst, lprSrc, lpFnCallback, lpContext)
#uselib "DCIMAN32.dll"
#func global DCIEnum "DCIEnum" sptr, sptr, sptr, sptr, sptr
; DCIEnum hdc, varptr(lprDst), varptr(lprSrc), lpFnCallback, lpContext   ; 戻り値は stat
; hdc : HDC -> "sptr"
; lprDst : RECT* in/out -> "sptr"
; lprSrc : RECT* in/out -> "sptr"
; lpFnCallback : void* in/out -> "sptr"
; lpContext : void* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "DCIMAN32.dll"
#cfunc global DCIEnum "DCIEnum" sptr, var, var, sptr, sptr
; res = DCIEnum(hdc, lprDst, lprSrc, lpFnCallback, lpContext)
; hdc : HDC -> "sptr"
; lprDst : RECT* in/out -> "var"
; lprSrc : RECT* in/out -> "var"
; lpFnCallback : void* in/out -> "sptr"
; lpContext : void* in/out -> "sptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; INT DCIEnum(HDC hdc, RECT* lprDst, RECT* lprSrc, void* lpFnCallback, void* lpContext)
#uselib "DCIMAN32.dll"
#cfunc global DCIEnum "DCIEnum" intptr, var, var, intptr, intptr
; res = DCIEnum(hdc, lprDst, lprSrc, lpFnCallback, lpContext)
; hdc : HDC -> "intptr"
; lprDst : RECT* in/out -> "var"
; lprSrc : RECT* in/out -> "var"
; lpFnCallback : void* in/out -> "intptr"
; lpContext : void* in/out -> "intptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	dciman32 = windows.NewLazySystemDLL("DCIMAN32.dll")
	procDCIEnum = dciman32.NewProc("DCIEnum")
)

// hdc (HDC), lprDst (RECT* in/out), lprSrc (RECT* in/out), lpFnCallback (void* in/out), lpContext (void* in/out)
r1, _, err := procDCIEnum.Call(
	uintptr(hdc),
	uintptr(lprDst),
	uintptr(lprSrc),
	uintptr(lpFnCallback),
	uintptr(lpContext),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // INT
function DCIEnum(
  hdc: THandle;   // HDC
  lprDst: Pointer;   // RECT* in/out
  lprSrc: Pointer;   // RECT* in/out
  lpFnCallback: Pointer;   // void* in/out
  lpContext: Pointer   // void* in/out
): Integer; stdcall;
  external 'DCIMAN32.dll' name 'DCIEnum';
result := DllCall("DCIMAN32\DCIEnum"
    , "Ptr", hdc   ; HDC
    , "Ptr", lprDst   ; RECT* in/out
    , "Ptr", lprSrc   ; RECT* in/out
    , "Ptr", lpFnCallback   ; void* in/out
    , "Ptr", lpContext   ; void* in/out
    , "Int")   ; return: INT
●DCIEnum(hdc, lprDst, lprSrc, lpFnCallback, lpContext) = DLL("DCIMAN32.dll", "int DCIEnum(void*, void*, void*, void*, void*)")
# 呼び出し: DCIEnum(hdc, lprDst, lprSrc, lpFnCallback, lpContext)
# hdc : HDC -> "void*"
# lprDst : RECT* in/out -> "void*"
# lprSrc : RECT* in/out -> "void*"
# lpFnCallback : void* in/out -> "void*"
# lpContext : void* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。