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

CMIsProfileValid

関数
指定カラープロファイルが有効かどうかを判定する。
DLLICM32.dll呼出規約winapi

シグネチャ

// ICM32.dll
#include <windows.h>

BOOL CMIsProfileValid(
    INT_PTR hProfile,
    BOOL* lpbValid
);

パラメーター

名前方向
hProfileINT_PTRin
lpbValidBOOL*out

戻り値の型: BOOL

各言語での呼び出し定義

// ICM32.dll
#include <windows.h>

BOOL CMIsProfileValid(
    INT_PTR hProfile,
    BOOL* lpbValid
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("ICM32.dll", ExactSpelling = true)]
static extern bool CMIsProfileValid(
    IntPtr hProfile,   // INT_PTR
    out int lpbValid   // BOOL* out
);
<DllImport("ICM32.dll", ExactSpelling:=True)>
Public Shared Function CMIsProfileValid(
    hProfile As IntPtr,   ' INT_PTR
    <Out> ByRef lpbValid As Integer   ' BOOL* out
) As Boolean
End Function
' hProfile : INT_PTR
' lpbValid : BOOL* out
Declare PtrSafe Function CMIsProfileValid Lib "icm32" ( _
    ByVal hProfile As LongPtr, _
    ByRef lpbValid As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

CMIsProfileValid = ctypes.windll.icm32.CMIsProfileValid
CMIsProfileValid.restype = wintypes.BOOL
CMIsProfileValid.argtypes = [
    ctypes.c_ssize_t,  # hProfile : INT_PTR
    ctypes.c_void_p,  # lpbValid : BOOL* out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('ICM32.dll')
CMIsProfileValid = Fiddle::Function.new(
  lib['CMIsProfileValid'],
  [
    Fiddle::TYPE_INTPTR_T,  # hProfile : INT_PTR
    Fiddle::TYPE_VOIDP,  # lpbValid : BOOL* out
  ],
  Fiddle::TYPE_INT)
#[link(name = "icm32")]
extern "system" {
    fn CMIsProfileValid(
        hProfile: isize,  // INT_PTR
        lpbValid: *mut i32  // BOOL* out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("ICM32.dll")]
public static extern bool CMIsProfileValid(IntPtr hProfile, out int lpbValid);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ICM32_CMIsProfileValid' -Namespace Win32 -PassThru
# $api::CMIsProfileValid(hProfile, lpbValid)
#uselib "ICM32.dll"
#func global CMIsProfileValid "CMIsProfileValid" sptr, sptr
; CMIsProfileValid hProfile, lpbValid   ; 戻り値は stat
; hProfile : INT_PTR -> "sptr"
; lpbValid : BOOL* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "ICM32.dll"
#cfunc global CMIsProfileValid "CMIsProfileValid" sptr, int
; res = CMIsProfileValid(hProfile, lpbValid)
; hProfile : INT_PTR -> "sptr"
; lpbValid : BOOL* out -> "int"
; BOOL CMIsProfileValid(INT_PTR hProfile, BOOL* lpbValid)
#uselib "ICM32.dll"
#cfunc global CMIsProfileValid "CMIsProfileValid" intptr, int
; res = CMIsProfileValid(hProfile, lpbValid)
; hProfile : INT_PTR -> "intptr"
; lpbValid : BOOL* out -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	icm32 = windows.NewLazySystemDLL("ICM32.dll")
	procCMIsProfileValid = icm32.NewProc("CMIsProfileValid")
)

// hProfile (INT_PTR), lpbValid (BOOL* out)
r1, _, err := procCMIsProfileValid.Call(
	uintptr(hProfile),
	uintptr(lpbValid),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function CMIsProfileValid(
  hProfile: NativeInt;   // INT_PTR
  lpbValid: Pointer   // BOOL* out
): BOOL; stdcall;
  external 'ICM32.dll' name 'CMIsProfileValid';
result := DllCall("ICM32\CMIsProfileValid"
    , "Ptr", hProfile   ; INT_PTR
    , "Ptr", lpbValid   ; BOOL* out
    , "Int")   ; return: BOOL
●CMIsProfileValid(hProfile, lpbValid) = DLL("ICM32.dll", "bool CMIsProfileValid(int, void*)")
# 呼び出し: CMIsProfileValid(hProfile, lpbValid)
# hProfile : INT_PTR -> "int"
# lpbValid : BOOL* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。