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

CreateDeviceLinkProfile

関数
複数プロファイルからデバイスリンクプロファイルを作成する。
DLLmscms.dll呼出規約winapi

シグネチャ

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

BOOL CreateDeviceLinkProfile(
    INT_PTR* hProfile,
    DWORD nProfiles,
    DWORD* padwIntent,
    DWORD nIntents,
    DWORD dwFlags,
    BYTE** pProfileData,
    DWORD indexPreferredCMM
);

パラメーター

名前方向
hProfileINT_PTR*in
nProfilesDWORDin
padwIntentDWORD*in
nIntentsDWORDin
dwFlagsDWORDin
pProfileDataBYTE**out
indexPreferredCMMDWORDin

戻り値の型: BOOL

各言語での呼び出し定義

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

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

CreateDeviceLinkProfile = ctypes.windll.mscms.CreateDeviceLinkProfile
CreateDeviceLinkProfile.restype = wintypes.BOOL
CreateDeviceLinkProfile.argtypes = [
    ctypes.POINTER(ctypes.c_ssize_t),  # hProfile : INT_PTR*
    wintypes.DWORD,  # nProfiles : DWORD
    ctypes.POINTER(wintypes.DWORD),  # padwIntent : DWORD*
    wintypes.DWORD,  # nIntents : DWORD
    wintypes.DWORD,  # dwFlags : DWORD
    ctypes.c_void_p,  # pProfileData : BYTE** out
    wintypes.DWORD,  # indexPreferredCMM : DWORD
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('mscms.dll')
CreateDeviceLinkProfile = Fiddle::Function.new(
  lib['CreateDeviceLinkProfile'],
  [
    Fiddle::TYPE_VOIDP,  # hProfile : INT_PTR*
    -Fiddle::TYPE_INT,  # nProfiles : DWORD
    Fiddle::TYPE_VOIDP,  # padwIntent : DWORD*
    -Fiddle::TYPE_INT,  # nIntents : DWORD
    -Fiddle::TYPE_INT,  # dwFlags : DWORD
    Fiddle::TYPE_VOIDP,  # pProfileData : BYTE** out
    -Fiddle::TYPE_INT,  # indexPreferredCMM : DWORD
  ],
  Fiddle::TYPE_INT)
#[link(name = "mscms")]
extern "system" {
    fn CreateDeviceLinkProfile(
        hProfile: *mut isize,  // INT_PTR*
        nProfiles: u32,  // DWORD
        padwIntent: *mut u32,  // DWORD*
        nIntents: u32,  // DWORD
        dwFlags: u32,  // DWORD
        pProfileData: *mut *mut u8,  // BYTE** out
        indexPreferredCMM: 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 CreateDeviceLinkProfile(ref IntPtr hProfile, uint nProfiles, ref uint padwIntent, uint nIntents, uint dwFlags, IntPtr pProfileData, uint indexPreferredCMM);
"@
$api = Add-Type -MemberDefinition $sig -Name 'mscms_CreateDeviceLinkProfile' -Namespace Win32 -PassThru
# $api::CreateDeviceLinkProfile(hProfile, nProfiles, padwIntent, nIntents, dwFlags, pProfileData, indexPreferredCMM)
#uselib "mscms.dll"
#func global CreateDeviceLinkProfile "CreateDeviceLinkProfile" sptr, sptr, sptr, sptr, sptr, sptr, sptr
; CreateDeviceLinkProfile varptr(hProfile), nProfiles, varptr(padwIntent), nIntents, dwFlags, varptr(pProfileData), indexPreferredCMM   ; 戻り値は stat
; hProfile : INT_PTR* -> "sptr"
; nProfiles : DWORD -> "sptr"
; padwIntent : DWORD* -> "sptr"
; nIntents : DWORD -> "sptr"
; dwFlags : DWORD -> "sptr"
; pProfileData : BYTE** out -> "sptr"
; indexPreferredCMM : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "mscms.dll"
#cfunc global CreateDeviceLinkProfile "CreateDeviceLinkProfile" var, int, var, int, int, var, int
; res = CreateDeviceLinkProfile(hProfile, nProfiles, padwIntent, nIntents, dwFlags, pProfileData, indexPreferredCMM)
; hProfile : INT_PTR* -> "var"
; nProfiles : DWORD -> "int"
; padwIntent : DWORD* -> "var"
; nIntents : DWORD -> "int"
; dwFlags : DWORD -> "int"
; pProfileData : BYTE** out -> "var"
; indexPreferredCMM : DWORD -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; BOOL CreateDeviceLinkProfile(INT_PTR* hProfile, DWORD nProfiles, DWORD* padwIntent, DWORD nIntents, DWORD dwFlags, BYTE** pProfileData, DWORD indexPreferredCMM)
#uselib "mscms.dll"
#cfunc global CreateDeviceLinkProfile "CreateDeviceLinkProfile" var, int, var, int, int, var, int
; res = CreateDeviceLinkProfile(hProfile, nProfiles, padwIntent, nIntents, dwFlags, pProfileData, indexPreferredCMM)
; hProfile : INT_PTR* -> "var"
; nProfiles : DWORD -> "int"
; padwIntent : DWORD* -> "var"
; nIntents : DWORD -> "int"
; dwFlags : DWORD -> "int"
; pProfileData : BYTE** out -> "var"
; indexPreferredCMM : DWORD -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	mscms = windows.NewLazySystemDLL("mscms.dll")
	procCreateDeviceLinkProfile = mscms.NewProc("CreateDeviceLinkProfile")
)

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