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

GetColorProfileElement

関数
プロファイルから指定タグの要素データを取得する。
DLLmscms.dll呼出規約winapi

シグネチャ

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

BOOL GetColorProfileElement(
    INT_PTR hProfile,
    DWORD tag,
    DWORD dwOffset,
    DWORD* pcbElement,
    void* pElement,   // optional
    BOOL* pbReference
);

パラメーター

名前方向
hProfileINT_PTRin
tagDWORDin
dwOffsetDWORDin
pcbElementDWORD*inout
pElementvoid*outoptional
pbReferenceBOOL*out

戻り値の型: BOOL

各言語での呼び出し定義

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

BOOL GetColorProfileElement(
    INT_PTR hProfile,
    DWORD tag,
    DWORD dwOffset,
    DWORD* pcbElement,
    void* pElement,   // optional
    BOOL* pbReference
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("mscms.dll", ExactSpelling = true)]
static extern bool GetColorProfileElement(
    IntPtr hProfile,   // INT_PTR
    uint tag,   // DWORD
    uint dwOffset,   // DWORD
    ref uint pcbElement,   // DWORD* in/out
    IntPtr pElement,   // void* optional, out
    out int pbReference   // BOOL* out
);
<DllImport("mscms.dll", ExactSpelling:=True)>
Public Shared Function GetColorProfileElement(
    hProfile As IntPtr,   ' INT_PTR
    tag As UInteger,   ' DWORD
    dwOffset As UInteger,   ' DWORD
    ByRef pcbElement As UInteger,   ' DWORD* in/out
    pElement As IntPtr,   ' void* optional, out
    <Out> ByRef pbReference As Integer   ' BOOL* out
) As Boolean
End Function
' hProfile : INT_PTR
' tag : DWORD
' dwOffset : DWORD
' pcbElement : DWORD* in/out
' pElement : void* optional, out
' pbReference : BOOL* out
Declare PtrSafe Function GetColorProfileElement Lib "mscms" ( _
    ByVal hProfile As LongPtr, _
    ByVal tag As Long, _
    ByVal dwOffset As Long, _
    ByRef pcbElement As Long, _
    ByVal pElement As LongPtr, _
    ByRef pbReference As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

GetColorProfileElement = ctypes.windll.mscms.GetColorProfileElement
GetColorProfileElement.restype = wintypes.BOOL
GetColorProfileElement.argtypes = [
    ctypes.c_ssize_t,  # hProfile : INT_PTR
    wintypes.DWORD,  # tag : DWORD
    wintypes.DWORD,  # dwOffset : DWORD
    ctypes.POINTER(wintypes.DWORD),  # pcbElement : DWORD* in/out
    ctypes.POINTER(None),  # pElement : void* optional, out
    ctypes.c_void_p,  # pbReference : BOOL* out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('mscms.dll')
GetColorProfileElement = Fiddle::Function.new(
  lib['GetColorProfileElement'],
  [
    Fiddle::TYPE_INTPTR_T,  # hProfile : INT_PTR
    -Fiddle::TYPE_INT,  # tag : DWORD
    -Fiddle::TYPE_INT,  # dwOffset : DWORD
    Fiddle::TYPE_VOIDP,  # pcbElement : DWORD* in/out
    Fiddle::TYPE_VOIDP,  # pElement : void* optional, out
    Fiddle::TYPE_VOIDP,  # pbReference : BOOL* out
  ],
  Fiddle::TYPE_INT)
#[link(name = "mscms")]
extern "system" {
    fn GetColorProfileElement(
        hProfile: isize,  // INT_PTR
        tag: u32,  // DWORD
        dwOffset: u32,  // DWORD
        pcbElement: *mut u32,  // DWORD* in/out
        pElement: *mut (),  // void* optional, out
        pbReference: *mut i32  // BOOL* out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("mscms.dll")]
public static extern bool GetColorProfileElement(IntPtr hProfile, uint tag, uint dwOffset, ref uint pcbElement, IntPtr pElement, out int pbReference);
"@
$api = Add-Type -MemberDefinition $sig -Name 'mscms_GetColorProfileElement' -Namespace Win32 -PassThru
# $api::GetColorProfileElement(hProfile, tag, dwOffset, pcbElement, pElement, pbReference)
#uselib "mscms.dll"
#func global GetColorProfileElement "GetColorProfileElement" sptr, sptr, sptr, sptr, sptr, sptr
; GetColorProfileElement hProfile, tag, dwOffset, varptr(pcbElement), pElement, pbReference   ; 戻り値は stat
; hProfile : INT_PTR -> "sptr"
; tag : DWORD -> "sptr"
; dwOffset : DWORD -> "sptr"
; pcbElement : DWORD* in/out -> "sptr"
; pElement : void* optional, out -> "sptr"
; pbReference : BOOL* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "mscms.dll"
#cfunc global GetColorProfileElement "GetColorProfileElement" sptr, int, int, var, sptr, int
; res = GetColorProfileElement(hProfile, tag, dwOffset, pcbElement, pElement, pbReference)
; hProfile : INT_PTR -> "sptr"
; tag : DWORD -> "int"
; dwOffset : DWORD -> "int"
; pcbElement : DWORD* in/out -> "var"
; pElement : void* optional, out -> "sptr"
; pbReference : BOOL* out -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; BOOL GetColorProfileElement(INT_PTR hProfile, DWORD tag, DWORD dwOffset, DWORD* pcbElement, void* pElement, BOOL* pbReference)
#uselib "mscms.dll"
#cfunc global GetColorProfileElement "GetColorProfileElement" intptr, int, int, var, intptr, int
; res = GetColorProfileElement(hProfile, tag, dwOffset, pcbElement, pElement, pbReference)
; hProfile : INT_PTR -> "intptr"
; tag : DWORD -> "int"
; dwOffset : DWORD -> "int"
; pcbElement : DWORD* in/out -> "var"
; pElement : void* optional, out -> "intptr"
; pbReference : BOOL* out -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	mscms = windows.NewLazySystemDLL("mscms.dll")
	procGetColorProfileElement = mscms.NewProc("GetColorProfileElement")
)

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