Win32 API 日本語リファレンス
ホームUI.ColorSystem › EnumICMProfilesW

EnumICMProfilesW

関数
DCで利用可能なICMプロファイルを列挙する(Unicode版)。
DLLGDI32.dll文字セットUnicode (-W)呼出規約winapi対応OSWindows 2000 以降

シグネチャ

// GDI32.dll  (Unicode / -W)
#include <windows.h>

INT EnumICMProfilesW(
    HDC hdc,
    ICMENUMPROCW proc,
    LPARAM param2   // optional
);

パラメーター

名前方向
hdcHDCin
procICMENUMPROCWin
param2LPARAMinoptional

戻り値の型: INT

各言語での呼び出し定義

// GDI32.dll  (Unicode / -W)
#include <windows.h>

INT EnumICMProfilesW(
    HDC hdc,
    ICMENUMPROCW proc,
    LPARAM param2   // optional
);
[DllImport("GDI32.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern int EnumICMProfilesW(
    IntPtr hdc,   // HDC
    IntPtr proc,   // ICMENUMPROCW
    IntPtr param2   // LPARAM optional
);
<DllImport("GDI32.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function EnumICMProfilesW(
    hdc As IntPtr,   ' HDC
    proc As IntPtr,   ' ICMENUMPROCW
    param2 As IntPtr   ' LPARAM optional
) As Integer
End Function
' hdc : HDC
' proc : ICMENUMPROCW
' param2 : LPARAM optional
Declare PtrSafe Function EnumICMProfilesW Lib "gdi32" ( _
    ByVal hdc As LongPtr, _
    ByVal proc As LongPtr, _
    ByVal param2 As LongPtr) As Long
' Unicode(W): 文字列は ByVal As LongPtr とし StrPtr(unicodeStr) を渡す
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

EnumICMProfilesW = ctypes.windll.gdi32.EnumICMProfilesW
EnumICMProfilesW.restype = ctypes.c_int
EnumICMProfilesW.argtypes = [
    wintypes.HANDLE,  # hdc : HDC
    ctypes.c_void_p,  # proc : ICMENUMPROCW
    ctypes.c_ssize_t,  # param2 : LPARAM optional
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('GDI32.dll')
EnumICMProfilesW = Fiddle::Function.new(
  lib['EnumICMProfilesW'],
  [
    Fiddle::TYPE_VOIDP,  # hdc : HDC
    Fiddle::TYPE_VOIDP,  # proc : ICMENUMPROCW
    Fiddle::TYPE_INTPTR_T,  # param2 : LPARAM optional
  ],
  Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"
#[link(name = "gdi32")]
extern "system" {
    fn EnumICMProfilesW(
        hdc: *mut core::ffi::c_void,  // HDC
        proc: *const core::ffi::c_void,  // ICMENUMPROCW
        param2: isize  // LPARAM optional
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("GDI32.dll", CharSet = CharSet.Unicode)]
public static extern int EnumICMProfilesW(IntPtr hdc, IntPtr proc, IntPtr param2);
"@
$api = Add-Type -MemberDefinition $sig -Name 'GDI32_EnumICMProfilesW' -Namespace Win32 -PassThru
# $api::EnumICMProfilesW(hdc, proc, param2)
#uselib "GDI32.dll"
#func global EnumICMProfilesW "EnumICMProfilesW" wptr, wptr, wptr
; EnumICMProfilesW hdc, proc, param2   ; 戻り値は stat
; hdc : HDC -> "wptr"
; proc : ICMENUMPROCW -> "wptr"
; param2 : LPARAM optional -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "GDI32.dll"
#cfunc global EnumICMProfilesW "EnumICMProfilesW" sptr, sptr, sptr
; res = EnumICMProfilesW(hdc, proc, param2)
; hdc : HDC -> "sptr"
; proc : ICMENUMPROCW -> "sptr"
; param2 : LPARAM optional -> "sptr"
; INT EnumICMProfilesW(HDC hdc, ICMENUMPROCW proc, LPARAM param2)
#uselib "GDI32.dll"
#cfunc global EnumICMProfilesW "EnumICMProfilesW" intptr, intptr, intptr
; res = EnumICMProfilesW(hdc, proc, param2)
; hdc : HDC -> "intptr"
; proc : ICMENUMPROCW -> "intptr"
; param2 : LPARAM optional -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	gdi32 = windows.NewLazySystemDLL("GDI32.dll")
	procEnumICMProfilesW = gdi32.NewProc("EnumICMProfilesW")
)

// hdc (HDC), proc (ICMENUMPROCW), param2 (LPARAM optional)
r1, _, err := procEnumICMProfilesW.Call(
	uintptr(hdc),
	uintptr(proc),
	uintptr(param2),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // INT
function EnumICMProfilesW(
  hdc: THandle;   // HDC
  proc: Pointer;   // ICMENUMPROCW
  param2: NativeInt   // LPARAM optional
): Integer; stdcall;
  external 'GDI32.dll' name 'EnumICMProfilesW';
result := DllCall("GDI32\EnumICMProfilesW"
    , "Ptr", hdc   ; HDC
    , "Ptr", proc   ; ICMENUMPROCW
    , "Ptr", param2   ; LPARAM optional
    , "Int")   ; return: INT
●EnumICMProfilesW(hdc, proc, param2) = DLL("GDI32.dll", "int EnumICMProfilesW(void*, void*, int)")
# 呼び出し: EnumICMProfilesW(hdc, proc, param2)
# hdc : HDC -> "void*"
# proc : ICMENUMPROCW -> "void*"
# param2 : LPARAM optional -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。