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