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

SetColorProfileElementReference

関数
プロファイル要素を別タグへの参照として設定する。
DLLmscms.dll呼出規約winapi

シグネチャ

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

BOOL SetColorProfileElementReference(
    INT_PTR hProfile,
    DWORD newTag,
    DWORD refTag
);

パラメーター

名前方向
hProfileINT_PTRin
newTagDWORDin
refTagDWORDin

戻り値の型: BOOL

各言語での呼び出し定義

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

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

SetColorProfileElementReference = ctypes.windll.mscms.SetColorProfileElementReference
SetColorProfileElementReference.restype = wintypes.BOOL
SetColorProfileElementReference.argtypes = [
    ctypes.c_ssize_t,  # hProfile : INT_PTR
    wintypes.DWORD,  # newTag : DWORD
    wintypes.DWORD,  # refTag : DWORD
]
require 'fiddle'
require 'fiddle/import'

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

var (
	mscms = windows.NewLazySystemDLL("mscms.dll")
	procSetColorProfileElementReference = mscms.NewProc("SetColorProfileElementReference")
)

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