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