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