ホーム › UI.ColorSystem › WcsAssociateColorProfileWithDevice
WcsAssociateColorProfileWithDevice
関数WCSでカラープロファイルをデバイスに関連付ける。
シグネチャ
// mscms.dll
#include <windows.h>
BOOL WcsAssociateColorProfileWithDevice(
WCS_PROFILE_MANAGEMENT_SCOPE scope,
LPCWSTR pProfileName,
LPCWSTR pDeviceName
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| scope | WCS_PROFILE_MANAGEMENT_SCOPE | in |
| pProfileName | LPCWSTR | in |
| pDeviceName | LPCWSTR | in |
戻り値の型: BOOL
各言語での呼び出し定義
// mscms.dll
#include <windows.h>
BOOL WcsAssociateColorProfileWithDevice(
WCS_PROFILE_MANAGEMENT_SCOPE scope,
LPCWSTR pProfileName,
LPCWSTR pDeviceName
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("mscms.dll", ExactSpelling = true)]
static extern bool WcsAssociateColorProfileWithDevice(
int scope, // WCS_PROFILE_MANAGEMENT_SCOPE
[MarshalAs(UnmanagedType.LPWStr)] string pProfileName, // LPCWSTR
[MarshalAs(UnmanagedType.LPWStr)] string pDeviceName // LPCWSTR
);<DllImport("mscms.dll", ExactSpelling:=True)>
Public Shared Function WcsAssociateColorProfileWithDevice(
scope As Integer, ' WCS_PROFILE_MANAGEMENT_SCOPE
<MarshalAs(UnmanagedType.LPWStr)> pProfileName As String, ' LPCWSTR
<MarshalAs(UnmanagedType.LPWStr)> pDeviceName As String ' LPCWSTR
) As Boolean
End Function' scope : WCS_PROFILE_MANAGEMENT_SCOPE
' pProfileName : LPCWSTR
' pDeviceName : LPCWSTR
Declare PtrSafe Function WcsAssociateColorProfileWithDevice Lib "mscms" ( _
ByVal scope As Long, _
ByVal pProfileName As LongPtr, _
ByVal pDeviceName As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
WcsAssociateColorProfileWithDevice = ctypes.windll.mscms.WcsAssociateColorProfileWithDevice
WcsAssociateColorProfileWithDevice.restype = wintypes.BOOL
WcsAssociateColorProfileWithDevice.argtypes = [
ctypes.c_int, # scope : WCS_PROFILE_MANAGEMENT_SCOPE
wintypes.LPCWSTR, # pProfileName : LPCWSTR
wintypes.LPCWSTR, # pDeviceName : LPCWSTR
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('mscms.dll')
WcsAssociateColorProfileWithDevice = Fiddle::Function.new(
lib['WcsAssociateColorProfileWithDevice'],
[
Fiddle::TYPE_INT, # scope : WCS_PROFILE_MANAGEMENT_SCOPE
Fiddle::TYPE_VOIDP, # pProfileName : LPCWSTR
Fiddle::TYPE_VOIDP, # pDeviceName : LPCWSTR
],
Fiddle::TYPE_INT)#[link(name = "mscms")]
extern "system" {
fn WcsAssociateColorProfileWithDevice(
scope: i32, // WCS_PROFILE_MANAGEMENT_SCOPE
pProfileName: *const u16, // LPCWSTR
pDeviceName: *const u16 // LPCWSTR
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("mscms.dll")]
public static extern bool WcsAssociateColorProfileWithDevice(int scope, [MarshalAs(UnmanagedType.LPWStr)] string pProfileName, [MarshalAs(UnmanagedType.LPWStr)] string pDeviceName);
"@
$api = Add-Type -MemberDefinition $sig -Name 'mscms_WcsAssociateColorProfileWithDevice' -Namespace Win32 -PassThru
# $api::WcsAssociateColorProfileWithDevice(scope, pProfileName, pDeviceName)#uselib "mscms.dll"
#func global WcsAssociateColorProfileWithDevice "WcsAssociateColorProfileWithDevice" sptr, sptr, sptr
; WcsAssociateColorProfileWithDevice scope, pProfileName, pDeviceName ; 戻り値は stat
; scope : WCS_PROFILE_MANAGEMENT_SCOPE -> "sptr"
; pProfileName : LPCWSTR -> "sptr"
; pDeviceName : LPCWSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "mscms.dll"
#cfunc global WcsAssociateColorProfileWithDevice "WcsAssociateColorProfileWithDevice" int, wstr, wstr
; res = WcsAssociateColorProfileWithDevice(scope, pProfileName, pDeviceName)
; scope : WCS_PROFILE_MANAGEMENT_SCOPE -> "int"
; pProfileName : LPCWSTR -> "wstr"
; pDeviceName : LPCWSTR -> "wstr"; BOOL WcsAssociateColorProfileWithDevice(WCS_PROFILE_MANAGEMENT_SCOPE scope, LPCWSTR pProfileName, LPCWSTR pDeviceName)
#uselib "mscms.dll"
#cfunc global WcsAssociateColorProfileWithDevice "WcsAssociateColorProfileWithDevice" int, wstr, wstr
; res = WcsAssociateColorProfileWithDevice(scope, pProfileName, pDeviceName)
; scope : WCS_PROFILE_MANAGEMENT_SCOPE -> "int"
; pProfileName : LPCWSTR -> "wstr"
; pDeviceName : LPCWSTR -> "wstr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
mscms = windows.NewLazySystemDLL("mscms.dll")
procWcsAssociateColorProfileWithDevice = mscms.NewProc("WcsAssociateColorProfileWithDevice")
)
// scope (WCS_PROFILE_MANAGEMENT_SCOPE), pProfileName (LPCWSTR), pDeviceName (LPCWSTR)
r1, _, err := procWcsAssociateColorProfileWithDevice.Call(
uintptr(scope),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pProfileName))),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pDeviceName))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction WcsAssociateColorProfileWithDevice(
scope: Integer; // WCS_PROFILE_MANAGEMENT_SCOPE
pProfileName: PWideChar; // LPCWSTR
pDeviceName: PWideChar // LPCWSTR
): BOOL; stdcall;
external 'mscms.dll' name 'WcsAssociateColorProfileWithDevice';result := DllCall("mscms\WcsAssociateColorProfileWithDevice"
, "Int", scope ; WCS_PROFILE_MANAGEMENT_SCOPE
, "WStr", pProfileName ; LPCWSTR
, "WStr", pDeviceName ; LPCWSTR
, "Int") ; return: BOOL●WcsAssociateColorProfileWithDevice(scope, pProfileName, pDeviceName) = DLL("mscms.dll", "bool WcsAssociateColorProfileWithDevice(int, char*, char*)")
# 呼び出し: WcsAssociateColorProfileWithDevice(scope, pProfileName, pDeviceName)
# scope : WCS_PROFILE_MANAGEMENT_SCOPE -> "int"
# pProfileName : LPCWSTR -> "char*"
# pDeviceName : LPCWSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。