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