ホーム › Graphics.Gdi › EnumEnhMetaFile
EnumEnhMetaFile
関数拡張メタファイル内の各レコードを列挙してコールバックに渡す。
シグネチャ
// GDI32.dll
#include <windows.h>
BOOL EnumEnhMetaFile(
HDC hdc, // optional
HENHMETAFILE hmf,
ENHMFENUMPROC proc,
void* param3, // optional
const RECT* lpRect // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hdc | HDC | inoptional |
| hmf | HENHMETAFILE | in |
| proc | ENHMFENUMPROC | in |
| param3 | void* | inoptional |
| lpRect | RECT* | inoptional |
戻り値の型: BOOL
各言語での呼び出し定義
// GDI32.dll
#include <windows.h>
BOOL EnumEnhMetaFile(
HDC hdc, // optional
HENHMETAFILE hmf,
ENHMFENUMPROC proc,
void* param3, // optional
const RECT* lpRect // optional
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("GDI32.dll", ExactSpelling = true)]
static extern bool EnumEnhMetaFile(
IntPtr hdc, // HDC optional
IntPtr hmf, // HENHMETAFILE
IntPtr proc, // ENHMFENUMPROC
IntPtr param3, // void* optional
IntPtr lpRect // RECT* optional
);<DllImport("GDI32.dll", ExactSpelling:=True)>
Public Shared Function EnumEnhMetaFile(
hdc As IntPtr, ' HDC optional
hmf As IntPtr, ' HENHMETAFILE
proc As IntPtr, ' ENHMFENUMPROC
param3 As IntPtr, ' void* optional
lpRect As IntPtr ' RECT* optional
) As Boolean
End Function' hdc : HDC optional
' hmf : HENHMETAFILE
' proc : ENHMFENUMPROC
' param3 : void* optional
' lpRect : RECT* optional
Declare PtrSafe Function EnumEnhMetaFile Lib "gdi32" ( _
ByVal hdc As LongPtr, _
ByVal hmf As LongPtr, _
ByVal proc As LongPtr, _
ByVal param3 As LongPtr, _
ByVal lpRect As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
EnumEnhMetaFile = ctypes.windll.gdi32.EnumEnhMetaFile
EnumEnhMetaFile.restype = wintypes.BOOL
EnumEnhMetaFile.argtypes = [
wintypes.HANDLE, # hdc : HDC optional
wintypes.HANDLE, # hmf : HENHMETAFILE
ctypes.c_void_p, # proc : ENHMFENUMPROC
ctypes.POINTER(None), # param3 : void* optional
ctypes.c_void_p, # lpRect : RECT* optional
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('GDI32.dll')
EnumEnhMetaFile = Fiddle::Function.new(
lib['EnumEnhMetaFile'],
[
Fiddle::TYPE_VOIDP, # hdc : HDC optional
Fiddle::TYPE_VOIDP, # hmf : HENHMETAFILE
Fiddle::TYPE_VOIDP, # proc : ENHMFENUMPROC
Fiddle::TYPE_VOIDP, # param3 : void* optional
Fiddle::TYPE_VOIDP, # lpRect : RECT* optional
],
Fiddle::TYPE_INT)#[link(name = "gdi32")]
extern "system" {
fn EnumEnhMetaFile(
hdc: *mut core::ffi::c_void, // HDC optional
hmf: *mut core::ffi::c_void, // HENHMETAFILE
proc: *const core::ffi::c_void, // ENHMFENUMPROC
param3: *mut (), // void* optional
lpRect: *const RECT // RECT* optional
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("GDI32.dll")]
public static extern bool EnumEnhMetaFile(IntPtr hdc, IntPtr hmf, IntPtr proc, IntPtr param3, IntPtr lpRect);
"@
$api = Add-Type -MemberDefinition $sig -Name 'GDI32_EnumEnhMetaFile' -Namespace Win32 -PassThru
# $api::EnumEnhMetaFile(hdc, hmf, proc, param3, lpRect)#uselib "GDI32.dll"
#func global EnumEnhMetaFile "EnumEnhMetaFile" sptr, sptr, sptr, sptr, sptr
; EnumEnhMetaFile hdc, hmf, proc, param3, varptr(lpRect) ; 戻り値は stat
; hdc : HDC optional -> "sptr"
; hmf : HENHMETAFILE -> "sptr"
; proc : ENHMFENUMPROC -> "sptr"
; param3 : void* optional -> "sptr"
; lpRect : RECT* optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "GDI32.dll" #cfunc global EnumEnhMetaFile "EnumEnhMetaFile" sptr, sptr, sptr, sptr, var ; res = EnumEnhMetaFile(hdc, hmf, proc, param3, lpRect) ; hdc : HDC optional -> "sptr" ; hmf : HENHMETAFILE -> "sptr" ; proc : ENHMFENUMPROC -> "sptr" ; param3 : void* optional -> "sptr" ; lpRect : RECT* optional -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "GDI32.dll" #cfunc global EnumEnhMetaFile "EnumEnhMetaFile" sptr, sptr, sptr, sptr, sptr ; res = EnumEnhMetaFile(hdc, hmf, proc, param3, varptr(lpRect)) ; hdc : HDC optional -> "sptr" ; hmf : HENHMETAFILE -> "sptr" ; proc : ENHMFENUMPROC -> "sptr" ; param3 : void* optional -> "sptr" ; lpRect : RECT* optional -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; BOOL EnumEnhMetaFile(HDC hdc, HENHMETAFILE hmf, ENHMFENUMPROC proc, void* param3, RECT* lpRect) #uselib "GDI32.dll" #cfunc global EnumEnhMetaFile "EnumEnhMetaFile" intptr, intptr, intptr, intptr, var ; res = EnumEnhMetaFile(hdc, hmf, proc, param3, lpRect) ; hdc : HDC optional -> "intptr" ; hmf : HENHMETAFILE -> "intptr" ; proc : ENHMFENUMPROC -> "intptr" ; param3 : void* optional -> "intptr" ; lpRect : RECT* optional -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL EnumEnhMetaFile(HDC hdc, HENHMETAFILE hmf, ENHMFENUMPROC proc, void* param3, RECT* lpRect) #uselib "GDI32.dll" #cfunc global EnumEnhMetaFile "EnumEnhMetaFile" intptr, intptr, intptr, intptr, intptr ; res = EnumEnhMetaFile(hdc, hmf, proc, param3, varptr(lpRect)) ; hdc : HDC optional -> "intptr" ; hmf : HENHMETAFILE -> "intptr" ; proc : ENHMFENUMPROC -> "intptr" ; param3 : void* optional -> "intptr" ; lpRect : RECT* optional -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
gdi32 = windows.NewLazySystemDLL("GDI32.dll")
procEnumEnhMetaFile = gdi32.NewProc("EnumEnhMetaFile")
)
// hdc (HDC optional), hmf (HENHMETAFILE), proc (ENHMFENUMPROC), param3 (void* optional), lpRect (RECT* optional)
r1, _, err := procEnumEnhMetaFile.Call(
uintptr(hdc),
uintptr(hmf),
uintptr(proc),
uintptr(param3),
uintptr(lpRect),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction EnumEnhMetaFile(
hdc: THandle; // HDC optional
hmf: THandle; // HENHMETAFILE
proc: Pointer; // ENHMFENUMPROC
param3: Pointer; // void* optional
lpRect: Pointer // RECT* optional
): BOOL; stdcall;
external 'GDI32.dll' name 'EnumEnhMetaFile';result := DllCall("GDI32\EnumEnhMetaFile"
, "Ptr", hdc ; HDC optional
, "Ptr", hmf ; HENHMETAFILE
, "Ptr", proc ; ENHMFENUMPROC
, "Ptr", param3 ; void* optional
, "Ptr", lpRect ; RECT* optional
, "Int") ; return: BOOL●EnumEnhMetaFile(hdc, hmf, proc, param3, lpRect) = DLL("GDI32.dll", "bool EnumEnhMetaFile(void*, void*, void*, void*, void*)")
# 呼び出し: EnumEnhMetaFile(hdc, hmf, proc, param3, lpRect)
# hdc : HDC optional -> "void*"
# hmf : HENHMETAFILE -> "void*"
# proc : ENHMFENUMPROC -> "void*"
# param3 : void* optional -> "void*"
# lpRect : RECT* optional -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。