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