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