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