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