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