ホーム › UI.ColorSystem › OpenColorProfileW
OpenColorProfileW
関数カラープロファイルを開いてハンドルを取得する(Unicode版)。
シグネチャ
// mscms.dll (Unicode / -W)
#include <windows.h>
INT_PTR OpenColorProfileW(
PROFILE* pProfile,
DWORD dwDesiredAccess,
DWORD dwShareMode,
DWORD dwCreationMode
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pProfile | PROFILE* | in |
| dwDesiredAccess | DWORD | in |
| dwShareMode | DWORD | in |
| dwCreationMode | DWORD | in |
戻り値の型: INT_PTR
各言語での呼び出し定義
// mscms.dll (Unicode / -W)
#include <windows.h>
INT_PTR OpenColorProfileW(
PROFILE* pProfile,
DWORD dwDesiredAccess,
DWORD dwShareMode,
DWORD dwCreationMode
);[DllImport("mscms.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern IntPtr OpenColorProfileW(
IntPtr pProfile, // PROFILE*
uint dwDesiredAccess, // DWORD
uint dwShareMode, // DWORD
uint dwCreationMode // DWORD
);<DllImport("mscms.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function OpenColorProfileW(
pProfile As IntPtr, ' PROFILE*
dwDesiredAccess As UInteger, ' DWORD
dwShareMode As UInteger, ' DWORD
dwCreationMode As UInteger ' DWORD
) As IntPtr
End Function' pProfile : PROFILE*
' dwDesiredAccess : DWORD
' dwShareMode : DWORD
' dwCreationMode : DWORD
Declare PtrSafe Function OpenColorProfileW Lib "mscms" ( _
ByVal pProfile As LongPtr, _
ByVal dwDesiredAccess As Long, _
ByVal dwShareMode As Long, _
ByVal dwCreationMode 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
OpenColorProfileW = ctypes.windll.mscms.OpenColorProfileW
OpenColorProfileW.restype = ctypes.c_ssize_t
OpenColorProfileW.argtypes = [
ctypes.c_void_p, # pProfile : PROFILE*
wintypes.DWORD, # dwDesiredAccess : DWORD
wintypes.DWORD, # dwShareMode : DWORD
wintypes.DWORD, # dwCreationMode : DWORD
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('mscms.dll')
OpenColorProfileW = Fiddle::Function.new(
lib['OpenColorProfileW'],
[
Fiddle::TYPE_VOIDP, # pProfile : PROFILE*
-Fiddle::TYPE_INT, # dwDesiredAccess : DWORD
-Fiddle::TYPE_INT, # dwShareMode : DWORD
-Fiddle::TYPE_INT, # dwCreationMode : DWORD
],
Fiddle::TYPE_INTPTR_T)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "mscms")]
extern "system" {
fn OpenColorProfileW(
pProfile: *mut PROFILE, // PROFILE*
dwDesiredAccess: u32, // DWORD
dwShareMode: u32, // DWORD
dwCreationMode: u32 // DWORD
) -> isize;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("mscms.dll", CharSet = CharSet.Unicode)]
public static extern IntPtr OpenColorProfileW(IntPtr pProfile, uint dwDesiredAccess, uint dwShareMode, uint dwCreationMode);
"@
$api = Add-Type -MemberDefinition $sig -Name 'mscms_OpenColorProfileW' -Namespace Win32 -PassThru
# $api::OpenColorProfileW(pProfile, dwDesiredAccess, dwShareMode, dwCreationMode)#uselib "mscms.dll"
#func global OpenColorProfileW "OpenColorProfileW" wptr, wptr, wptr, wptr
; OpenColorProfileW varptr(pProfile), dwDesiredAccess, dwShareMode, dwCreationMode ; 戻り値は stat
; pProfile : PROFILE* -> "wptr"
; dwDesiredAccess : DWORD -> "wptr"
; dwShareMode : DWORD -> "wptr"
; dwCreationMode : DWORD -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "mscms.dll" #cfunc global OpenColorProfileW "OpenColorProfileW" var, int, int, int ; res = OpenColorProfileW(pProfile, dwDesiredAccess, dwShareMode, dwCreationMode) ; pProfile : PROFILE* -> "var" ; dwDesiredAccess : DWORD -> "int" ; dwShareMode : DWORD -> "int" ; dwCreationMode : DWORD -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "mscms.dll" #cfunc global OpenColorProfileW "OpenColorProfileW" sptr, int, int, int ; res = OpenColorProfileW(varptr(pProfile), dwDesiredAccess, dwShareMode, dwCreationMode) ; pProfile : PROFILE* -> "sptr" ; dwDesiredAccess : DWORD -> "int" ; dwShareMode : DWORD -> "int" ; dwCreationMode : DWORD -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; INT_PTR OpenColorProfileW(PROFILE* pProfile, DWORD dwDesiredAccess, DWORD dwShareMode, DWORD dwCreationMode) #uselib "mscms.dll" #cfunc global OpenColorProfileW "OpenColorProfileW" var, int, int, int ; res = OpenColorProfileW(pProfile, dwDesiredAccess, dwShareMode, dwCreationMode) ; pProfile : PROFILE* -> "var" ; dwDesiredAccess : DWORD -> "int" ; dwShareMode : DWORD -> "int" ; dwCreationMode : DWORD -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; INT_PTR OpenColorProfileW(PROFILE* pProfile, DWORD dwDesiredAccess, DWORD dwShareMode, DWORD dwCreationMode) #uselib "mscms.dll" #cfunc global OpenColorProfileW "OpenColorProfileW" intptr, int, int, int ; res = OpenColorProfileW(varptr(pProfile), dwDesiredAccess, dwShareMode, dwCreationMode) ; pProfile : PROFILE* -> "intptr" ; dwDesiredAccess : DWORD -> "int" ; dwShareMode : DWORD -> "int" ; dwCreationMode : DWORD -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
mscms = windows.NewLazySystemDLL("mscms.dll")
procOpenColorProfileW = mscms.NewProc("OpenColorProfileW")
)
// pProfile (PROFILE*), dwDesiredAccess (DWORD), dwShareMode (DWORD), dwCreationMode (DWORD)
r1, _, err := procOpenColorProfileW.Call(
uintptr(pProfile),
uintptr(dwDesiredAccess),
uintptr(dwShareMode),
uintptr(dwCreationMode),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INT_PTRfunction OpenColorProfileW(
pProfile: Pointer; // PROFILE*
dwDesiredAccess: DWORD; // DWORD
dwShareMode: DWORD; // DWORD
dwCreationMode: DWORD // DWORD
): NativeInt; stdcall;
external 'mscms.dll' name 'OpenColorProfileW';result := DllCall("mscms\OpenColorProfileW"
, "Ptr", pProfile ; PROFILE*
, "UInt", dwDesiredAccess ; DWORD
, "UInt", dwShareMode ; DWORD
, "UInt", dwCreationMode ; DWORD
, "Ptr") ; return: INT_PTR●OpenColorProfileW(pProfile, dwDesiredAccess, dwShareMode, dwCreationMode) = DLL("mscms.dll", "int OpenColorProfileW(void*, dword, dword, dword)")
# 呼び出し: OpenColorProfileW(pProfile, dwDesiredAccess, dwShareMode, dwCreationMode)
# pProfile : PROFILE* -> "void*"
# dwDesiredAccess : DWORD -> "dword"
# dwShareMode : DWORD -> "dword"
# dwCreationMode : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。