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

WcsOpenColorProfileW

関数
WCSの複数プロファイルを開きハンドルを返す(Unicode版)。
DLLmscms.dll文字セットUnicode (-W)呼出規約winapi

シグネチャ

// mscms.dll  (Unicode / -W)
#include <windows.h>

INT_PTR WcsOpenColorProfileW(
    PROFILE* pCDMPProfile,
    PROFILE* pCAMPProfile,   // optional
    PROFILE* pGMMPProfile,   // optional
    DWORD dwDesireAccess,
    DWORD dwShareMode,
    DWORD dwCreationMode,
    DWORD dwFlags
);

パラメーター

名前方向
pCDMPProfilePROFILE*in
pCAMPProfilePROFILE*inoptional
pGMMPProfilePROFILE*inoptional
dwDesireAccessDWORDin
dwShareModeDWORDin
dwCreationModeDWORDin
dwFlagsDWORDin

戻り値の型: INT_PTR

各言語での呼び出し定義

// mscms.dll  (Unicode / -W)
#include <windows.h>

INT_PTR WcsOpenColorProfileW(
    PROFILE* pCDMPProfile,
    PROFILE* pCAMPProfile,   // optional
    PROFILE* pGMMPProfile,   // optional
    DWORD dwDesireAccess,
    DWORD dwShareMode,
    DWORD dwCreationMode,
    DWORD dwFlags
);
[DllImport("mscms.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern IntPtr WcsOpenColorProfileW(
    IntPtr pCDMPProfile,   // PROFILE*
    IntPtr pCAMPProfile,   // PROFILE* optional
    IntPtr pGMMPProfile,   // PROFILE* optional
    uint dwDesireAccess,   // DWORD
    uint dwShareMode,   // DWORD
    uint dwCreationMode,   // DWORD
    uint dwFlags   // DWORD
);
<DllImport("mscms.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function WcsOpenColorProfileW(
    pCDMPProfile As IntPtr,   ' PROFILE*
    pCAMPProfile As IntPtr,   ' PROFILE* optional
    pGMMPProfile As IntPtr,   ' PROFILE* optional
    dwDesireAccess As UInteger,   ' DWORD
    dwShareMode As UInteger,   ' DWORD
    dwCreationMode As UInteger,   ' DWORD
    dwFlags As UInteger   ' DWORD
) As IntPtr
End Function
' pCDMPProfile : PROFILE*
' pCAMPProfile : PROFILE* optional
' pGMMPProfile : PROFILE* optional
' dwDesireAccess : DWORD
' dwShareMode : DWORD
' dwCreationMode : DWORD
' dwFlags : DWORD
Declare PtrSafe Function WcsOpenColorProfileW Lib "mscms" ( _
    ByVal pCDMPProfile As LongPtr, _
    ByVal pCAMPProfile As LongPtr, _
    ByVal pGMMPProfile As LongPtr, _
    ByVal dwDesireAccess As Long, _
    ByVal dwShareMode As Long, _
    ByVal dwCreationMode As Long, _
    ByVal dwFlags As Long) As LongPtr
' Unicode(W): 文字列は ByVal As LongPtr とし StrPtr(unicodeStr) を渡す
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

WcsOpenColorProfileW = ctypes.windll.mscms.WcsOpenColorProfileW
WcsOpenColorProfileW.restype = ctypes.c_ssize_t
WcsOpenColorProfileW.argtypes = [
    ctypes.c_void_p,  # pCDMPProfile : PROFILE*
    ctypes.c_void_p,  # pCAMPProfile : PROFILE* optional
    ctypes.c_void_p,  # pGMMPProfile : PROFILE* optional
    wintypes.DWORD,  # dwDesireAccess : DWORD
    wintypes.DWORD,  # dwShareMode : DWORD
    wintypes.DWORD,  # dwCreationMode : DWORD
    wintypes.DWORD,  # dwFlags : DWORD
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('mscms.dll')
WcsOpenColorProfileW = Fiddle::Function.new(
  lib['WcsOpenColorProfileW'],
  [
    Fiddle::TYPE_VOIDP,  # pCDMPProfile : PROFILE*
    Fiddle::TYPE_VOIDP,  # pCAMPProfile : PROFILE* optional
    Fiddle::TYPE_VOIDP,  # pGMMPProfile : PROFILE* optional
    -Fiddle::TYPE_INT,  # dwDesireAccess : DWORD
    -Fiddle::TYPE_INT,  # dwShareMode : DWORD
    -Fiddle::TYPE_INT,  # dwCreationMode : DWORD
    -Fiddle::TYPE_INT,  # dwFlags : DWORD
  ],
  Fiddle::TYPE_INTPTR_T)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"
#[link(name = "mscms")]
extern "system" {
    fn WcsOpenColorProfileW(
        pCDMPProfile: *mut PROFILE,  // PROFILE*
        pCAMPProfile: *mut PROFILE,  // PROFILE* optional
        pGMMPProfile: *mut PROFILE,  // PROFILE* optional
        dwDesireAccess: u32,  // DWORD
        dwShareMode: u32,  // DWORD
        dwCreationMode: u32,  // DWORD
        dwFlags: u32  // DWORD
    ) -> isize;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("mscms.dll", CharSet = CharSet.Unicode)]
public static extern IntPtr WcsOpenColorProfileW(IntPtr pCDMPProfile, IntPtr pCAMPProfile, IntPtr pGMMPProfile, uint dwDesireAccess, uint dwShareMode, uint dwCreationMode, uint dwFlags);
"@
$api = Add-Type -MemberDefinition $sig -Name 'mscms_WcsOpenColorProfileW' -Namespace Win32 -PassThru
# $api::WcsOpenColorProfileW(pCDMPProfile, pCAMPProfile, pGMMPProfile, dwDesireAccess, dwShareMode, dwCreationMode, dwFlags)
#uselib "mscms.dll"
#func global WcsOpenColorProfileW "WcsOpenColorProfileW" wptr, wptr, wptr, wptr, wptr, wptr, wptr
; WcsOpenColorProfileW varptr(pCDMPProfile), varptr(pCAMPProfile), varptr(pGMMPProfile), dwDesireAccess, dwShareMode, dwCreationMode, dwFlags   ; 戻り値は stat
; pCDMPProfile : PROFILE* -> "wptr"
; pCAMPProfile : PROFILE* optional -> "wptr"
; pGMMPProfile : PROFILE* optional -> "wptr"
; dwDesireAccess : DWORD -> "wptr"
; dwShareMode : DWORD -> "wptr"
; dwCreationMode : DWORD -> "wptr"
; dwFlags : DWORD -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "mscms.dll"
#cfunc global WcsOpenColorProfileW "WcsOpenColorProfileW" var, var, var, int, int, int, int
; res = WcsOpenColorProfileW(pCDMPProfile, pCAMPProfile, pGMMPProfile, dwDesireAccess, dwShareMode, dwCreationMode, dwFlags)
; pCDMPProfile : PROFILE* -> "var"
; pCAMPProfile : PROFILE* optional -> "var"
; pGMMPProfile : PROFILE* optional -> "var"
; dwDesireAccess : DWORD -> "int"
; dwShareMode : DWORD -> "int"
; dwCreationMode : DWORD -> "int"
; dwFlags : DWORD -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; INT_PTR WcsOpenColorProfileW(PROFILE* pCDMPProfile, PROFILE* pCAMPProfile, PROFILE* pGMMPProfile, DWORD dwDesireAccess, DWORD dwShareMode, DWORD dwCreationMode, DWORD dwFlags)
#uselib "mscms.dll"
#cfunc global WcsOpenColorProfileW "WcsOpenColorProfileW" var, var, var, int, int, int, int
; res = WcsOpenColorProfileW(pCDMPProfile, pCAMPProfile, pGMMPProfile, dwDesireAccess, dwShareMode, dwCreationMode, dwFlags)
; pCDMPProfile : PROFILE* -> "var"
; pCAMPProfile : PROFILE* optional -> "var"
; pGMMPProfile : PROFILE* optional -> "var"
; dwDesireAccess : DWORD -> "int"
; dwShareMode : DWORD -> "int"
; dwCreationMode : DWORD -> "int"
; dwFlags : DWORD -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	mscms = windows.NewLazySystemDLL("mscms.dll")
	procWcsOpenColorProfileW = mscms.NewProc("WcsOpenColorProfileW")
)

// pCDMPProfile (PROFILE*), pCAMPProfile (PROFILE* optional), pGMMPProfile (PROFILE* optional), dwDesireAccess (DWORD), dwShareMode (DWORD), dwCreationMode (DWORD), dwFlags (DWORD)
r1, _, err := procWcsOpenColorProfileW.Call(
	uintptr(pCDMPProfile),
	uintptr(pCAMPProfile),
	uintptr(pGMMPProfile),
	uintptr(dwDesireAccess),
	uintptr(dwShareMode),
	uintptr(dwCreationMode),
	uintptr(dwFlags),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // INT_PTR
function WcsOpenColorProfileW(
  pCDMPProfile: Pointer;   // PROFILE*
  pCAMPProfile: Pointer;   // PROFILE* optional
  pGMMPProfile: Pointer;   // PROFILE* optional
  dwDesireAccess: DWORD;   // DWORD
  dwShareMode: DWORD;   // DWORD
  dwCreationMode: DWORD;   // DWORD
  dwFlags: DWORD   // DWORD
): NativeInt; stdcall;
  external 'mscms.dll' name 'WcsOpenColorProfileW';
result := DllCall("mscms\WcsOpenColorProfileW"
    , "Ptr", pCDMPProfile   ; PROFILE*
    , "Ptr", pCAMPProfile   ; PROFILE* optional
    , "Ptr", pGMMPProfile   ; PROFILE* optional
    , "UInt", dwDesireAccess   ; DWORD
    , "UInt", dwShareMode   ; DWORD
    , "UInt", dwCreationMode   ; DWORD
    , "UInt", dwFlags   ; DWORD
    , "Ptr")   ; return: INT_PTR
●WcsOpenColorProfileW(pCDMPProfile, pCAMPProfile, pGMMPProfile, dwDesireAccess, dwShareMode, dwCreationMode, dwFlags) = DLL("mscms.dll", "int WcsOpenColorProfileW(void*, void*, void*, dword, dword, dword, dword)")
# 呼び出し: WcsOpenColorProfileW(pCDMPProfile, pCAMPProfile, pGMMPProfile, dwDesireAccess, dwShareMode, dwCreationMode, dwFlags)
# pCDMPProfile : PROFILE* -> "void*"
# pCAMPProfile : PROFILE* optional -> "void*"
# pGMMPProfile : PROFILE* optional -> "void*"
# dwDesireAccess : DWORD -> "dword"
# dwShareMode : DWORD -> "dword"
# dwCreationMode : DWORD -> "dword"
# dwFlags : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。