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

SetColorProfileElement

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

シグネチャ

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

BOOL SetColorProfileElement(
    INT_PTR hProfile,
    DWORD tag,
    DWORD dwOffset,
    DWORD* pcbElement,
    void* pElement
);

パラメーター

名前方向
hProfileINT_PTRin
tagDWORDin
dwOffsetDWORDin
pcbElementDWORD*in
pElementvoid*in

戻り値の型: BOOL

各言語での呼び出し定義

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

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

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

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

var (
	mscms = windows.NewLazySystemDLL("mscms.dll")
	procSetColorProfileElement = mscms.NewProc("SetColorProfileElement")
)

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