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

EnumICMProfilesA

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

シグネチャ

// GDI32.dll  (ANSI / -A)
#include <windows.h>

INT EnumICMProfilesA(
    HDC hdc,
    ICMENUMPROCA proc,
    LPARAM param2   // optional
);

パラメーター

名前方向
hdcHDCin
procICMENUMPROCAin
param2LPARAMinoptional

戻り値の型: INT

各言語での呼び出し定義

// GDI32.dll  (ANSI / -A)
#include <windows.h>

INT EnumICMProfilesA(
    HDC hdc,
    ICMENUMPROCA proc,
    LPARAM param2   // optional
);
[DllImport("GDI32.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern int EnumICMProfilesA(
    IntPtr hdc,   // HDC
    IntPtr proc,   // ICMENUMPROCA
    IntPtr param2   // LPARAM optional
);
<DllImport("GDI32.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function EnumICMProfilesA(
    hdc As IntPtr,   ' HDC
    proc As IntPtr,   ' ICMENUMPROCA
    param2 As IntPtr   ' LPARAM optional
) As Integer
End Function
' hdc : HDC
' proc : ICMENUMPROCA
' param2 : LPARAM optional
Declare PtrSafe Function EnumICMProfilesA Lib "gdi32" ( _
    ByVal hdc As LongPtr, _
    ByVal proc As LongPtr, _
    ByVal param2 As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

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

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

var (
	gdi32 = windows.NewLazySystemDLL("GDI32.dll")
	procEnumICMProfilesA = gdi32.NewProc("EnumICMProfilesA")
)

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