ホーム › Devices.Display › DestroyPhysicalMonitors
DestroyPhysicalMonitors
関数物理モニタのハンドル配列をまとめて破棄する。
シグネチャ
// dxva2.dll
#include <windows.h>
BOOL DestroyPhysicalMonitors(
DWORD dwPhysicalMonitorArraySize,
PHYSICAL_MONITOR* pPhysicalMonitorArray
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| dwPhysicalMonitorArraySize | DWORD | in | pPhysicalMonitorArray 配列の要素数。 |
| pPhysicalMonitorArray | PHYSICAL_MONITOR* | in | PHYSICAL_MONITOR 構造体の配列へのポインター。 |
戻り値の型: BOOL
公式ドキュメント
物理モニターハンドルの配列を閉じます。
戻り値
関数が成功した場合、戻り値は TRUE です。関数が失敗した場合、戻り値は FALSE です。拡張エラー情報を取得するには、GetLastError を呼び出します。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での呼び出し定義
// dxva2.dll
#include <windows.h>
BOOL DestroyPhysicalMonitors(
DWORD dwPhysicalMonitorArraySize,
PHYSICAL_MONITOR* pPhysicalMonitorArray
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("dxva2.dll", SetLastError = true, ExactSpelling = true)]
static extern bool DestroyPhysicalMonitors(
uint dwPhysicalMonitorArraySize, // DWORD
IntPtr pPhysicalMonitorArray // PHYSICAL_MONITOR*
);<DllImport("dxva2.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function DestroyPhysicalMonitors(
dwPhysicalMonitorArraySize As UInteger, ' DWORD
pPhysicalMonitorArray As IntPtr ' PHYSICAL_MONITOR*
) As <MarshalAs(UnmanagedType.Bool)> Boolean
End Function' dwPhysicalMonitorArraySize : DWORD
' pPhysicalMonitorArray : PHYSICAL_MONITOR*
Declare PtrSafe Function DestroyPhysicalMonitors Lib "dxva2" ( _
ByVal dwPhysicalMonitorArraySize As Long, _
ByVal pPhysicalMonitorArray As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
DestroyPhysicalMonitors = ctypes.windll.dxva2.DestroyPhysicalMonitors
DestroyPhysicalMonitors.restype = wintypes.BOOL
DestroyPhysicalMonitors.argtypes = [
wintypes.DWORD, # dwPhysicalMonitorArraySize : DWORD
ctypes.c_void_p, # pPhysicalMonitorArray : PHYSICAL_MONITOR*
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('dxva2.dll')
DestroyPhysicalMonitors = Fiddle::Function.new(
lib['DestroyPhysicalMonitors'],
[
-Fiddle::TYPE_INT, # dwPhysicalMonitorArraySize : DWORD
Fiddle::TYPE_VOIDP, # pPhysicalMonitorArray : PHYSICAL_MONITOR*
],
Fiddle::TYPE_INT)#[link(name = "dxva2")]
extern "system" {
fn DestroyPhysicalMonitors(
dwPhysicalMonitorArraySize: u32, // DWORD
pPhysicalMonitorArray: *mut PHYSICAL_MONITOR // PHYSICAL_MONITOR*
) -> 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 DestroyPhysicalMonitors(uint dwPhysicalMonitorArraySize, IntPtr pPhysicalMonitorArray);
"@
$api = Add-Type -MemberDefinition $sig -Name 'dxva2_DestroyPhysicalMonitors' -Namespace Win32 -PassThru
# $api::DestroyPhysicalMonitors(dwPhysicalMonitorArraySize, pPhysicalMonitorArray)#uselib "dxva2.dll"
#func global DestroyPhysicalMonitors "DestroyPhysicalMonitors" sptr, sptr
; DestroyPhysicalMonitors dwPhysicalMonitorArraySize, varptr(pPhysicalMonitorArray) ; 戻り値は stat
; dwPhysicalMonitorArraySize : DWORD -> "sptr"
; pPhysicalMonitorArray : PHYSICAL_MONITOR* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "dxva2.dll" #cfunc global DestroyPhysicalMonitors "DestroyPhysicalMonitors" int, var ; res = DestroyPhysicalMonitors(dwPhysicalMonitorArraySize, pPhysicalMonitorArray) ; dwPhysicalMonitorArraySize : DWORD -> "int" ; pPhysicalMonitorArray : PHYSICAL_MONITOR* -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "dxva2.dll" #cfunc global DestroyPhysicalMonitors "DestroyPhysicalMonitors" int, sptr ; res = DestroyPhysicalMonitors(dwPhysicalMonitorArraySize, varptr(pPhysicalMonitorArray)) ; dwPhysicalMonitorArraySize : DWORD -> "int" ; pPhysicalMonitorArray : PHYSICAL_MONITOR* -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; BOOL DestroyPhysicalMonitors(DWORD dwPhysicalMonitorArraySize, PHYSICAL_MONITOR* pPhysicalMonitorArray) #uselib "dxva2.dll" #cfunc global DestroyPhysicalMonitors "DestroyPhysicalMonitors" int, var ; res = DestroyPhysicalMonitors(dwPhysicalMonitorArraySize, pPhysicalMonitorArray) ; dwPhysicalMonitorArraySize : DWORD -> "int" ; pPhysicalMonitorArray : PHYSICAL_MONITOR* -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL DestroyPhysicalMonitors(DWORD dwPhysicalMonitorArraySize, PHYSICAL_MONITOR* pPhysicalMonitorArray) #uselib "dxva2.dll" #cfunc global DestroyPhysicalMonitors "DestroyPhysicalMonitors" int, intptr ; res = DestroyPhysicalMonitors(dwPhysicalMonitorArraySize, varptr(pPhysicalMonitorArray)) ; dwPhysicalMonitorArraySize : DWORD -> "int" ; pPhysicalMonitorArray : PHYSICAL_MONITOR* -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
dxva2 = windows.NewLazySystemDLL("dxva2.dll")
procDestroyPhysicalMonitors = dxva2.NewProc("DestroyPhysicalMonitors")
)
// dwPhysicalMonitorArraySize (DWORD), pPhysicalMonitorArray (PHYSICAL_MONITOR*)
r1, _, err := procDestroyPhysicalMonitors.Call(
uintptr(dwPhysicalMonitorArraySize),
uintptr(pPhysicalMonitorArray),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction DestroyPhysicalMonitors(
dwPhysicalMonitorArraySize: DWORD; // DWORD
pPhysicalMonitorArray: Pointer // PHYSICAL_MONITOR*
): BOOL; stdcall;
external 'dxva2.dll' name 'DestroyPhysicalMonitors';result := DllCall("dxva2\DestroyPhysicalMonitors"
, "UInt", dwPhysicalMonitorArraySize ; DWORD
, "Ptr", pPhysicalMonitorArray ; PHYSICAL_MONITOR*
, "Int") ; return: BOOL●DestroyPhysicalMonitors(dwPhysicalMonitorArraySize, pPhysicalMonitorArray) = DLL("dxva2.dll", "bool DestroyPhysicalMonitors(dword, void*)")
# 呼び出し: DestroyPhysicalMonitors(dwPhysicalMonitorArraySize, pPhysicalMonitorArray)
# dwPhysicalMonitorArraySize : DWORD -> "dword"
# pPhysicalMonitorArray : PHYSICAL_MONITOR* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "dxva2" fn DestroyPhysicalMonitors(
dwPhysicalMonitorArraySize: u32, // DWORD
pPhysicalMonitorArray: [*c]PHYSICAL_MONITOR // PHYSICAL_MONITOR*
) callconv(std.os.windows.WINAPI) i32;proc DestroyPhysicalMonitors(
dwPhysicalMonitorArraySize: uint32, # DWORD
pPhysicalMonitorArray: ptr PHYSICAL_MONITOR # PHYSICAL_MONITOR*
): int32 {.importc: "DestroyPhysicalMonitors", stdcall, dynlib: "dxva2.dll".}pragma(lib, "dxva2");
extern(Windows)
int DestroyPhysicalMonitors(
uint dwPhysicalMonitorArraySize, // DWORD
PHYSICAL_MONITOR* pPhysicalMonitorArray // PHYSICAL_MONITOR*
);ccall((:DestroyPhysicalMonitors, "dxva2.dll"), stdcall, Int32,
(UInt32, Ptr{PHYSICAL_MONITOR}),
dwPhysicalMonitorArraySize, pPhysicalMonitorArray)
# dwPhysicalMonitorArraySize : DWORD -> UInt32
# pPhysicalMonitorArray : PHYSICAL_MONITOR* -> Ptr{PHYSICAL_MONITOR}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t DestroyPhysicalMonitors(
uint32_t dwPhysicalMonitorArraySize,
void* pPhysicalMonitorArray);
]]
local dxva2 = ffi.load("dxva2")
-- dxva2.DestroyPhysicalMonitors(dwPhysicalMonitorArraySize, pPhysicalMonitorArray)
-- dwPhysicalMonitorArraySize : DWORD
-- pPhysicalMonitorArray : PHYSICAL_MONITOR*
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('dxva2.dll');
const DestroyPhysicalMonitors = lib.func('__stdcall', 'DestroyPhysicalMonitors', 'int32_t', ['uint32_t', 'void *']);
// DestroyPhysicalMonitors(dwPhysicalMonitorArraySize, pPhysicalMonitorArray)
// dwPhysicalMonitorArraySize : DWORD -> 'uint32_t'
// pPhysicalMonitorArray : PHYSICAL_MONITOR* -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("dxva2.dll", {
DestroyPhysicalMonitors: { parameters: ["u32", "pointer"], result: "i32" },
});
// lib.symbols.DestroyPhysicalMonitors(dwPhysicalMonitorArraySize, pPhysicalMonitorArray)
// dwPhysicalMonitorArraySize : DWORD -> "u32"
// pPhysicalMonitorArray : PHYSICAL_MONITOR* -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t DestroyPhysicalMonitors(
uint32_t dwPhysicalMonitorArraySize,
void* pPhysicalMonitorArray);
C, "dxva2.dll");
// $ffi->DestroyPhysicalMonitors(dwPhysicalMonitorArraySize, pPhysicalMonitorArray);
// dwPhysicalMonitorArraySize : DWORD
// pPhysicalMonitorArray : PHYSICAL_MONITOR*
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Dxva2 extends StdCallLibrary {
Dxva2 INSTANCE = Native.load("dxva2", Dxva2.class);
boolean DestroyPhysicalMonitors(
int dwPhysicalMonitorArraySize, // DWORD
Pointer pPhysicalMonitorArray // PHYSICAL_MONITOR*
);
}@[Link("dxva2")]
lib Libdxva2
fun DestroyPhysicalMonitors = DestroyPhysicalMonitors(
dwPhysicalMonitorArraySize : UInt32, # DWORD
pPhysicalMonitorArray : PHYSICAL_MONITOR* # PHYSICAL_MONITOR*
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef DestroyPhysicalMonitorsNative = Int32 Function(Uint32, Pointer<Void>);
typedef DestroyPhysicalMonitorsDart = int Function(int, Pointer<Void>);
final DestroyPhysicalMonitors = DynamicLibrary.open('dxva2.dll')
.lookupFunction<DestroyPhysicalMonitorsNative, DestroyPhysicalMonitorsDart>('DestroyPhysicalMonitors');
// dwPhysicalMonitorArraySize : DWORD -> Uint32
// pPhysicalMonitorArray : PHYSICAL_MONITOR* -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function DestroyPhysicalMonitors(
dwPhysicalMonitorArraySize: DWORD; // DWORD
pPhysicalMonitorArray: Pointer // PHYSICAL_MONITOR*
): BOOL; stdcall;
external 'dxva2.dll' name 'DestroyPhysicalMonitors';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "DestroyPhysicalMonitors"
c_DestroyPhysicalMonitors :: Word32 -> Ptr () -> IO CInt
-- dwPhysicalMonitorArraySize : DWORD -> Word32
-- pPhysicalMonitorArray : PHYSICAL_MONITOR* -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let destroyphysicalmonitors =
foreign "DestroyPhysicalMonitors"
(uint32_t @-> (ptr void) @-> returning int32_t)
(* dwPhysicalMonitorArraySize : DWORD -> uint32_t *)
(* pPhysicalMonitorArray : PHYSICAL_MONITOR* -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library dxva2 (t "dxva2.dll"))
(cffi:use-foreign-library dxva2)
(cffi:defcfun ("DestroyPhysicalMonitors" destroy-physical-monitors :convention :stdcall) :int32
(dw-physical-monitor-array-size :uint32) ; DWORD
(p-physical-monitor-array :pointer)) ; PHYSICAL_MONITOR*
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $DestroyPhysicalMonitors = Win32::API::More->new('dxva2',
'BOOL DestroyPhysicalMonitors(DWORD dwPhysicalMonitorArraySize, LPVOID pPhysicalMonitorArray)');
# my $ret = $DestroyPhysicalMonitors->Call($dwPhysicalMonitorArraySize, $pPhysicalMonitorArray);
# dwPhysicalMonitorArraySize : DWORD -> DWORD
# pPhysicalMonitorArray : PHYSICAL_MONITOR* -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
公式の関連項目
- f DestroyPhysicalMonitor — 物理モニタのハンドルを破棄して解放する。
使用する型