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