ホーム › UI.ColorSystem › SetColorProfileElementReference
SetColorProfileElementReference
関数プロファイル要素を別タグへの参照として設定する。
シグネチャ
// mscms.dll
#include <windows.h>
BOOL SetColorProfileElementReference(
INT_PTR hProfile,
DWORD newTag,
DWORD refTag
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| hProfile | INT_PTR | in | 要素参照を設定する対象のカラープロファイルハンドル。 |
| newTag | DWORD | in | 既存要素を参照させる新しいタグのシグネチャ値。 |
| refTag | DWORD | in | 参照先となる既存要素のタグシグネチャ値。 |
戻り値の型: 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 <MarshalAs(UnmanagedType.Bool)> 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 // BOOLfunction 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)。const std = @import("std");
extern "mscms" fn SetColorProfileElementReference(
hProfile: isize, // INT_PTR
newTag: u32, // DWORD
refTag: u32 // DWORD
) callconv(std.os.windows.WINAPI) i32;proc SetColorProfileElementReference(
hProfile: int, # INT_PTR
newTag: uint32, # DWORD
refTag: uint32 # DWORD
): int32 {.importc: "SetColorProfileElementReference", stdcall, dynlib: "mscms.dll".}pragma(lib, "mscms");
extern(Windows)
int SetColorProfileElementReference(
ptrdiff_t hProfile, // INT_PTR
uint newTag, // DWORD
uint refTag // DWORD
);ccall((:SetColorProfileElementReference, "mscms.dll"), stdcall, Int32,
(Int, UInt32, UInt32),
hProfile, newTag, refTag)
# hProfile : INT_PTR -> Int
# newTag : DWORD -> UInt32
# refTag : DWORD -> UInt32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t SetColorProfileElementReference(
intptr_t hProfile,
uint32_t newTag,
uint32_t refTag);
]]
local mscms = ffi.load("mscms")
-- mscms.SetColorProfileElementReference(hProfile, newTag, refTag)
-- hProfile : INT_PTR
-- newTag : DWORD
-- refTag : DWORD
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('mscms.dll');
const SetColorProfileElementReference = lib.func('__stdcall', 'SetColorProfileElementReference', 'int32_t', ['intptr_t', 'uint32_t', 'uint32_t']);
// SetColorProfileElementReference(hProfile, newTag, refTag)
// hProfile : INT_PTR -> 'intptr_t'
// newTag : DWORD -> 'uint32_t'
// refTag : DWORD -> 'uint32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("mscms.dll", {
SetColorProfileElementReference: { parameters: ["isize", "u32", "u32"], result: "i32" },
});
// lib.symbols.SetColorProfileElementReference(hProfile, newTag, refTag)
// hProfile : INT_PTR -> "isize"
// newTag : DWORD -> "u32"
// refTag : DWORD -> "u32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t SetColorProfileElementReference(
intptr_t hProfile,
uint32_t newTag,
uint32_t refTag);
C, "mscms.dll");
// $ffi->SetColorProfileElementReference(hProfile, newTag, refTag);
// hProfile : INT_PTR
// newTag : DWORD
// refTag : DWORD
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Mscms extends StdCallLibrary {
Mscms INSTANCE = Native.load("mscms", Mscms.class);
boolean SetColorProfileElementReference(
long hProfile, // INT_PTR
int newTag, // DWORD
int refTag // DWORD
);
}@[Link("mscms")]
lib Libmscms
fun SetColorProfileElementReference = SetColorProfileElementReference(
hProfile : LibC::SSizeT, # INT_PTR
newTag : UInt32, # DWORD
refTag : UInt32 # DWORD
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef SetColorProfileElementReferenceNative = Int32 Function(IntPtr, Uint32, Uint32);
typedef SetColorProfileElementReferenceDart = int Function(int, int, int);
final SetColorProfileElementReference = DynamicLibrary.open('mscms.dll')
.lookupFunction<SetColorProfileElementReferenceNative, SetColorProfileElementReferenceDart>('SetColorProfileElementReference');
// hProfile : INT_PTR -> IntPtr
// newTag : DWORD -> Uint32
// refTag : DWORD -> Uint32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function SetColorProfileElementReference(
hProfile: NativeInt; // INT_PTR
newTag: DWORD; // DWORD
refTag: DWORD // DWORD
): BOOL; stdcall;
external 'mscms.dll' name 'SetColorProfileElementReference';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "SetColorProfileElementReference"
c_SetColorProfileElementReference :: CIntPtr -> Word32 -> Word32 -> IO CInt
-- hProfile : INT_PTR -> CIntPtr
-- newTag : DWORD -> Word32
-- refTag : DWORD -> Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let setcolorprofileelementreference =
foreign "SetColorProfileElementReference"
(intptr_t @-> uint32_t @-> uint32_t @-> returning int32_t)
(* hProfile : INT_PTR -> intptr_t *)
(* newTag : DWORD -> uint32_t *)
(* refTag : DWORD -> uint32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library mscms (t "mscms.dll"))
(cffi:use-foreign-library mscms)
(cffi:defcfun ("SetColorProfileElementReference" set-color-profile-element-reference :convention :stdcall) :int32
(h-profile :int64) ; INT_PTR
(new-tag :uint32) ; DWORD
(ref-tag :uint32)) ; DWORD
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $SetColorProfileElementReference = Win32::API::More->new('mscms',
'BOOL SetColorProfileElementReference(LPARAM hProfile, DWORD newTag, DWORD refTag)');
# my $ret = $SetColorProfileElementReference->Call($hProfile, $newTag, $refTag);
# hProfile : INT_PTR -> LPARAM
# newTag : DWORD -> DWORD
# refTag : DWORD -> DWORD
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。