ホーム › Devices.Display › GetPhysicalMonitorsFromIDirect3DDevice9
GetPhysicalMonitorsFromIDirect3DDevice9
関数Direct3D9デバイスから物理モニタのハンドル配列を取得する。
シグネチャ
// dxva2.dll
#include <windows.h>
HRESULT GetPhysicalMonitorsFromIDirect3DDevice9(
IDirect3DDevice9* pDirect3DDevice9,
DWORD dwPhysicalMonitorArraySize,
PHYSICAL_MONITOR* pPhysicalMonitorArray
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pDirect3DDevice9 | IDirect3DDevice9* | in |
| dwPhysicalMonitorArraySize | DWORD | in |
| pPhysicalMonitorArray | PHYSICAL_MONITOR* | out |
戻り値の型: HRESULT
各言語での呼び出し定義
// dxva2.dll
#include <windows.h>
HRESULT GetPhysicalMonitorsFromIDirect3DDevice9(
IDirect3DDevice9* pDirect3DDevice9,
DWORD dwPhysicalMonitorArraySize,
PHYSICAL_MONITOR* pPhysicalMonitorArray
);[DllImport("dxva2.dll", ExactSpelling = true)]
static extern int GetPhysicalMonitorsFromIDirect3DDevice9(
IntPtr pDirect3DDevice9, // IDirect3DDevice9*
uint dwPhysicalMonitorArraySize, // DWORD
IntPtr pPhysicalMonitorArray // PHYSICAL_MONITOR* out
);<DllImport("dxva2.dll", ExactSpelling:=True)>
Public Shared Function GetPhysicalMonitorsFromIDirect3DDevice9(
pDirect3DDevice9 As IntPtr, ' IDirect3DDevice9*
dwPhysicalMonitorArraySize As UInteger, ' DWORD
pPhysicalMonitorArray As IntPtr ' PHYSICAL_MONITOR* out
) As Integer
End Function' pDirect3DDevice9 : IDirect3DDevice9*
' dwPhysicalMonitorArraySize : DWORD
' pPhysicalMonitorArray : PHYSICAL_MONITOR* out
Declare PtrSafe Function GetPhysicalMonitorsFromIDirect3DDevice9 Lib "dxva2" ( _
ByVal pDirect3DDevice9 As LongPtr, _
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
GetPhysicalMonitorsFromIDirect3DDevice9 = ctypes.windll.dxva2.GetPhysicalMonitorsFromIDirect3DDevice9
GetPhysicalMonitorsFromIDirect3DDevice9.restype = ctypes.c_int
GetPhysicalMonitorsFromIDirect3DDevice9.argtypes = [
ctypes.c_void_p, # pDirect3DDevice9 : IDirect3DDevice9*
wintypes.DWORD, # dwPhysicalMonitorArraySize : DWORD
ctypes.c_void_p, # pPhysicalMonitorArray : PHYSICAL_MONITOR* out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('dxva2.dll')
GetPhysicalMonitorsFromIDirect3DDevice9 = Fiddle::Function.new(
lib['GetPhysicalMonitorsFromIDirect3DDevice9'],
[
Fiddle::TYPE_VOIDP, # pDirect3DDevice9 : IDirect3DDevice9*
-Fiddle::TYPE_INT, # dwPhysicalMonitorArraySize : DWORD
Fiddle::TYPE_VOIDP, # pPhysicalMonitorArray : PHYSICAL_MONITOR* out
],
Fiddle::TYPE_INT)#[link(name = "dxva2")]
extern "system" {
fn GetPhysicalMonitorsFromIDirect3DDevice9(
pDirect3DDevice9: *mut core::ffi::c_void, // IDirect3DDevice9*
dwPhysicalMonitorArraySize: u32, // DWORD
pPhysicalMonitorArray: *mut PHYSICAL_MONITOR // PHYSICAL_MONITOR* out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("dxva2.dll")]
public static extern int GetPhysicalMonitorsFromIDirect3DDevice9(IntPtr pDirect3DDevice9, uint dwPhysicalMonitorArraySize, IntPtr pPhysicalMonitorArray);
"@
$api = Add-Type -MemberDefinition $sig -Name 'dxva2_GetPhysicalMonitorsFromIDirect3DDevice9' -Namespace Win32 -PassThru
# $api::GetPhysicalMonitorsFromIDirect3DDevice9(pDirect3DDevice9, dwPhysicalMonitorArraySize, pPhysicalMonitorArray)#uselib "dxva2.dll"
#func global GetPhysicalMonitorsFromIDirect3DDevice9 "GetPhysicalMonitorsFromIDirect3DDevice9" sptr, sptr, sptr
; GetPhysicalMonitorsFromIDirect3DDevice9 pDirect3DDevice9, dwPhysicalMonitorArraySize, varptr(pPhysicalMonitorArray) ; 戻り値は stat
; pDirect3DDevice9 : IDirect3DDevice9* -> "sptr"
; dwPhysicalMonitorArraySize : DWORD -> "sptr"
; pPhysicalMonitorArray : PHYSICAL_MONITOR* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "dxva2.dll" #cfunc global GetPhysicalMonitorsFromIDirect3DDevice9 "GetPhysicalMonitorsFromIDirect3DDevice9" sptr, int, var ; res = GetPhysicalMonitorsFromIDirect3DDevice9(pDirect3DDevice9, dwPhysicalMonitorArraySize, pPhysicalMonitorArray) ; pDirect3DDevice9 : IDirect3DDevice9* -> "sptr" ; dwPhysicalMonitorArraySize : DWORD -> "int" ; pPhysicalMonitorArray : PHYSICAL_MONITOR* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "dxva2.dll" #cfunc global GetPhysicalMonitorsFromIDirect3DDevice9 "GetPhysicalMonitorsFromIDirect3DDevice9" sptr, int, sptr ; res = GetPhysicalMonitorsFromIDirect3DDevice9(pDirect3DDevice9, dwPhysicalMonitorArraySize, varptr(pPhysicalMonitorArray)) ; pDirect3DDevice9 : IDirect3DDevice9* -> "sptr" ; dwPhysicalMonitorArraySize : DWORD -> "int" ; pPhysicalMonitorArray : PHYSICAL_MONITOR* out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT GetPhysicalMonitorsFromIDirect3DDevice9(IDirect3DDevice9* pDirect3DDevice9, DWORD dwPhysicalMonitorArraySize, PHYSICAL_MONITOR* pPhysicalMonitorArray) #uselib "dxva2.dll" #cfunc global GetPhysicalMonitorsFromIDirect3DDevice9 "GetPhysicalMonitorsFromIDirect3DDevice9" intptr, int, var ; res = GetPhysicalMonitorsFromIDirect3DDevice9(pDirect3DDevice9, dwPhysicalMonitorArraySize, pPhysicalMonitorArray) ; pDirect3DDevice9 : IDirect3DDevice9* -> "intptr" ; dwPhysicalMonitorArraySize : DWORD -> "int" ; pPhysicalMonitorArray : PHYSICAL_MONITOR* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT GetPhysicalMonitorsFromIDirect3DDevice9(IDirect3DDevice9* pDirect3DDevice9, DWORD dwPhysicalMonitorArraySize, PHYSICAL_MONITOR* pPhysicalMonitorArray) #uselib "dxva2.dll" #cfunc global GetPhysicalMonitorsFromIDirect3DDevice9 "GetPhysicalMonitorsFromIDirect3DDevice9" intptr, int, intptr ; res = GetPhysicalMonitorsFromIDirect3DDevice9(pDirect3DDevice9, dwPhysicalMonitorArraySize, varptr(pPhysicalMonitorArray)) ; pDirect3DDevice9 : IDirect3DDevice9* -> "intptr" ; dwPhysicalMonitorArraySize : DWORD -> "int" ; pPhysicalMonitorArray : PHYSICAL_MONITOR* out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
dxva2 = windows.NewLazySystemDLL("dxva2.dll")
procGetPhysicalMonitorsFromIDirect3DDevice9 = dxva2.NewProc("GetPhysicalMonitorsFromIDirect3DDevice9")
)
// pDirect3DDevice9 (IDirect3DDevice9*), dwPhysicalMonitorArraySize (DWORD), pPhysicalMonitorArray (PHYSICAL_MONITOR* out)
r1, _, err := procGetPhysicalMonitorsFromIDirect3DDevice9.Call(
uintptr(pDirect3DDevice9),
uintptr(dwPhysicalMonitorArraySize),
uintptr(pPhysicalMonitorArray),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction GetPhysicalMonitorsFromIDirect3DDevice9(
pDirect3DDevice9: Pointer; // IDirect3DDevice9*
dwPhysicalMonitorArraySize: DWORD; // DWORD
pPhysicalMonitorArray: Pointer // PHYSICAL_MONITOR* out
): Integer; stdcall;
external 'dxva2.dll' name 'GetPhysicalMonitorsFromIDirect3DDevice9';result := DllCall("dxva2\GetPhysicalMonitorsFromIDirect3DDevice9"
, "Ptr", pDirect3DDevice9 ; IDirect3DDevice9*
, "UInt", dwPhysicalMonitorArraySize ; DWORD
, "Ptr", pPhysicalMonitorArray ; PHYSICAL_MONITOR* out
, "Int") ; return: HRESULT●GetPhysicalMonitorsFromIDirect3DDevice9(pDirect3DDevice9, dwPhysicalMonitorArraySize, pPhysicalMonitorArray) = DLL("dxva2.dll", "int GetPhysicalMonitorsFromIDirect3DDevice9(void*, dword, void*)")
# 呼び出し: GetPhysicalMonitorsFromIDirect3DDevice9(pDirect3DDevice9, dwPhysicalMonitorArraySize, pPhysicalMonitorArray)
# pDirect3DDevice9 : IDirect3DDevice9* -> "void*"
# dwPhysicalMonitorArraySize : DWORD -> "dword"
# pPhysicalMonitorArray : PHYSICAL_MONITOR* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。