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