Win32 API 日本語リファレンス
ホームGraphics.Gdi › DeleteMetaFile

DeleteMetaFile

関数
メタファイルのハンドルを解放して削除する。
DLLGDI32.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

// GDI32.dll
#include <windows.h>

BOOL DeleteMetaFile(
    HMETAFILE hmf
);

パラメーター

名前方向
hmfHMETAFILEin

戻り値の型: BOOL

各言語での呼び出し定義

// GDI32.dll
#include <windows.h>

BOOL DeleteMetaFile(
    HMETAFILE hmf
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("GDI32.dll", ExactSpelling = true)]
static extern bool DeleteMetaFile(
    IntPtr hmf   // HMETAFILE
);
<DllImport("GDI32.dll", ExactSpelling:=True)>
Public Shared Function DeleteMetaFile(
    hmf As IntPtr   ' HMETAFILE
) As Boolean
End Function
' hmf : HMETAFILE
Declare PtrSafe Function DeleteMetaFile Lib "gdi32" ( _
    ByVal hmf As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

DeleteMetaFile = ctypes.windll.gdi32.DeleteMetaFile
DeleteMetaFile.restype = wintypes.BOOL
DeleteMetaFile.argtypes = [
    wintypes.HANDLE,  # hmf : HMETAFILE
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('GDI32.dll')
DeleteMetaFile = Fiddle::Function.new(
  lib['DeleteMetaFile'],
  [
    Fiddle::TYPE_VOIDP,  # hmf : HMETAFILE
  ],
  Fiddle::TYPE_INT)
#[link(name = "gdi32")]
extern "system" {
    fn DeleteMetaFile(
        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 DeleteMetaFile(IntPtr hmf);
"@
$api = Add-Type -MemberDefinition $sig -Name 'GDI32_DeleteMetaFile' -Namespace Win32 -PassThru
# $api::DeleteMetaFile(hmf)
#uselib "GDI32.dll"
#func global DeleteMetaFile "DeleteMetaFile" sptr
; DeleteMetaFile hmf   ; 戻り値は stat
; hmf : HMETAFILE -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "GDI32.dll"
#cfunc global DeleteMetaFile "DeleteMetaFile" sptr
; res = DeleteMetaFile(hmf)
; hmf : HMETAFILE -> "sptr"
; BOOL DeleteMetaFile(HMETAFILE hmf)
#uselib "GDI32.dll"
#cfunc global DeleteMetaFile "DeleteMetaFile" intptr
; res = DeleteMetaFile(hmf)
; hmf : HMETAFILE -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	gdi32 = windows.NewLazySystemDLL("GDI32.dll")
	procDeleteMetaFile = gdi32.NewProc("DeleteMetaFile")
)

// hmf (HMETAFILE)
r1, _, err := procDeleteMetaFile.Call(
	uintptr(hmf),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function DeleteMetaFile(
  hmf: THandle   // HMETAFILE
): BOOL; stdcall;
  external 'GDI32.dll' name 'DeleteMetaFile';
result := DllCall("GDI32\DeleteMetaFile"
    , "Ptr", hmf   ; HMETAFILE
    , "Int")   ; return: BOOL
●DeleteMetaFile(hmf) = DLL("GDI32.dll", "bool DeleteMetaFile(void*)")
# 呼び出し: DeleteMetaFile(hmf)
# hmf : HMETAFILE -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。