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