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