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