Win32 API 日本語リファレンス
ホームDevices.Display › DestroyPhysicalMonitor

DestroyPhysicalMonitor

関数
物理モニタのハンドルを破棄して解放する。
DLLdxva2.dll呼出規約winapiSetLastErrorあり対応OSWindows Vista 以降

シグネチャ

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

BOOL DestroyPhysicalMonitor(
    HANDLE hMonitor
);

パラメーター

名前方向
hMonitorHANDLEin

戻り値の型: BOOL

各言語での呼び出し定義

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

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

DestroyPhysicalMonitor = ctypes.windll.dxva2.DestroyPhysicalMonitor
DestroyPhysicalMonitor.restype = wintypes.BOOL
DestroyPhysicalMonitor.argtypes = [
    wintypes.HANDLE,  # hMonitor : HANDLE
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('dxva2.dll')
DestroyPhysicalMonitor = Fiddle::Function.new(
  lib['DestroyPhysicalMonitor'],
  [
    Fiddle::TYPE_VOIDP,  # hMonitor : HANDLE
  ],
  Fiddle::TYPE_INT)
#[link(name = "dxva2")]
extern "system" {
    fn DestroyPhysicalMonitor(
        hMonitor: *mut core::ffi::c_void  // HANDLE
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("dxva2.dll", SetLastError = true)]
public static extern bool DestroyPhysicalMonitor(IntPtr hMonitor);
"@
$api = Add-Type -MemberDefinition $sig -Name 'dxva2_DestroyPhysicalMonitor' -Namespace Win32 -PassThru
# $api::DestroyPhysicalMonitor(hMonitor)
#uselib "dxva2.dll"
#func global DestroyPhysicalMonitor "DestroyPhysicalMonitor" sptr
; DestroyPhysicalMonitor hMonitor   ; 戻り値は stat
; hMonitor : HANDLE -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "dxva2.dll"
#cfunc global DestroyPhysicalMonitor "DestroyPhysicalMonitor" sptr
; res = DestroyPhysicalMonitor(hMonitor)
; hMonitor : HANDLE -> "sptr"
; BOOL DestroyPhysicalMonitor(HANDLE hMonitor)
#uselib "dxva2.dll"
#cfunc global DestroyPhysicalMonitor "DestroyPhysicalMonitor" intptr
; res = DestroyPhysicalMonitor(hMonitor)
; hMonitor : HANDLE -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	dxva2 = windows.NewLazySystemDLL("dxva2.dll")
	procDestroyPhysicalMonitor = dxva2.NewProc("DestroyPhysicalMonitor")
)

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