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

WcsOpenColorProfileA

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

シグネチャ

// mscms.dll  (ANSI / -A)
#include <windows.h>

INT_PTR WcsOpenColorProfileA(
    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  (ANSI / -A)
#include <windows.h>

INT_PTR WcsOpenColorProfileA(
    PROFILE* pCDMPProfile,
    PROFILE* pCAMPProfile,   // optional
    PROFILE* pGMMPProfile,   // optional
    DWORD dwDesireAccess,
    DWORD dwShareMode,
    DWORD dwCreationMode,
    DWORD dwFlags
);
[DllImport("mscms.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern IntPtr WcsOpenColorProfileA(
    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.Ansi, ExactSpelling:=True)>
Public Shared Function WcsOpenColorProfileA(
    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 WcsOpenColorProfileA 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
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

WcsOpenColorProfileA = ctypes.windll.mscms.WcsOpenColorProfileA
WcsOpenColorProfileA.restype = ctypes.c_ssize_t
WcsOpenColorProfileA.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')
WcsOpenColorProfileA = Fiddle::Function.new(
  lib['WcsOpenColorProfileA'],
  [
    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)
#[link(name = "mscms")]
extern "system" {
    fn WcsOpenColorProfileA(
        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.Ansi)]
public static extern IntPtr WcsOpenColorProfileA(IntPtr pCDMPProfile, IntPtr pCAMPProfile, IntPtr pGMMPProfile, uint dwDesireAccess, uint dwShareMode, uint dwCreationMode, uint dwFlags);
"@
$api = Add-Type -MemberDefinition $sig -Name 'mscms_WcsOpenColorProfileA' -Namespace Win32 -PassThru
# $api::WcsOpenColorProfileA(pCDMPProfile, pCAMPProfile, pGMMPProfile, dwDesireAccess, dwShareMode, dwCreationMode, dwFlags)
#uselib "mscms.dll"
#func global WcsOpenColorProfileA "WcsOpenColorProfileA" sptr, sptr, sptr, sptr, sptr, sptr, sptr
; WcsOpenColorProfileA varptr(pCDMPProfile), varptr(pCAMPProfile), varptr(pGMMPProfile), dwDesireAccess, dwShareMode, dwCreationMode, dwFlags   ; 戻り値は stat
; pCDMPProfile : PROFILE* -> "sptr"
; pCAMPProfile : PROFILE* optional -> "sptr"
; pGMMPProfile : PROFILE* optional -> "sptr"
; dwDesireAccess : DWORD -> "sptr"
; dwShareMode : DWORD -> "sptr"
; dwCreationMode : DWORD -> "sptr"
; dwFlags : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "mscms.dll"
#cfunc global WcsOpenColorProfileA "WcsOpenColorProfileA" var, var, var, int, int, int, int
; res = WcsOpenColorProfileA(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 WcsOpenColorProfileA(PROFILE* pCDMPProfile, PROFILE* pCAMPProfile, PROFILE* pGMMPProfile, DWORD dwDesireAccess, DWORD dwShareMode, DWORD dwCreationMode, DWORD dwFlags)
#uselib "mscms.dll"
#cfunc global WcsOpenColorProfileA "WcsOpenColorProfileA" var, var, var, int, int, int, int
; res = WcsOpenColorProfileA(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")
	procWcsOpenColorProfileA = mscms.NewProc("WcsOpenColorProfileA")
)

// pCDMPProfile (PROFILE*), pCAMPProfile (PROFILE* optional), pGMMPProfile (PROFILE* optional), dwDesireAccess (DWORD), dwShareMode (DWORD), dwCreationMode (DWORD), dwFlags (DWORD)
r1, _, err := procWcsOpenColorProfileA.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 WcsOpenColorProfileA(
  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 'WcsOpenColorProfileA';
result := DllCall("mscms\WcsOpenColorProfileA"
    , "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
●WcsOpenColorProfileA(pCDMPProfile, pCAMPProfile, pGMMPProfile, dwDesireAccess, dwShareMode, dwCreationMode, dwFlags) = DLL("mscms.dll", "int WcsOpenColorProfileA(void*, void*, void*, dword, dword, dword, dword)")
# 呼び出し: WcsOpenColorProfileA(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)。