ホーム › UI.ColorSystem › AssociateColorProfileWithDeviceW
AssociateColorProfileWithDeviceW
関数カラープロファイルをデバイスに関連付ける(Unicode版)。
シグネチャ
// mscms.dll (Unicode / -W)
#include <windows.h>
BOOL AssociateColorProfileWithDeviceW(
LPCWSTR pMachineName, // optional
LPCWSTR pProfileName,
LPCWSTR pDeviceName
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pMachineName | LPCWSTR | inoptional |
| pProfileName | LPCWSTR | in |
| pDeviceName | LPCWSTR | in |
戻り値の型: BOOL
各言語での呼び出し定義
// mscms.dll (Unicode / -W)
#include <windows.h>
BOOL AssociateColorProfileWithDeviceW(
LPCWSTR pMachineName, // optional
LPCWSTR pProfileName,
LPCWSTR pDeviceName
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("mscms.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern bool AssociateColorProfileWithDeviceW(
[MarshalAs(UnmanagedType.LPWStr)] string pMachineName, // LPCWSTR optional
[MarshalAs(UnmanagedType.LPWStr)] string pProfileName, // LPCWSTR
[MarshalAs(UnmanagedType.LPWStr)] string pDeviceName // LPCWSTR
);<DllImport("mscms.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function AssociateColorProfileWithDeviceW(
<MarshalAs(UnmanagedType.LPWStr)> pMachineName As String, ' LPCWSTR optional
<MarshalAs(UnmanagedType.LPWStr)> pProfileName As String, ' LPCWSTR
<MarshalAs(UnmanagedType.LPWStr)> pDeviceName As String ' LPCWSTR
) As Boolean
End Function' pMachineName : LPCWSTR optional
' pProfileName : LPCWSTR
' pDeviceName : LPCWSTR
Declare PtrSafe Function AssociateColorProfileWithDeviceW Lib "mscms" ( _
ByVal pMachineName As LongPtr, _
ByVal pProfileName As LongPtr, _
ByVal pDeviceName As LongPtr) As Long
' 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
AssociateColorProfileWithDeviceW = ctypes.windll.mscms.AssociateColorProfileWithDeviceW
AssociateColorProfileWithDeviceW.restype = wintypes.BOOL
AssociateColorProfileWithDeviceW.argtypes = [
wintypes.LPCWSTR, # pMachineName : LPCWSTR optional
wintypes.LPCWSTR, # pProfileName : LPCWSTR
wintypes.LPCWSTR, # pDeviceName : LPCWSTR
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('mscms.dll')
AssociateColorProfileWithDeviceW = Fiddle::Function.new(
lib['AssociateColorProfileWithDeviceW'],
[
Fiddle::TYPE_VOIDP, # pMachineName : LPCWSTR optional
Fiddle::TYPE_VOIDP, # pProfileName : LPCWSTR
Fiddle::TYPE_VOIDP, # pDeviceName : LPCWSTR
],
Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "mscms")]
extern "system" {
fn AssociateColorProfileWithDeviceW(
pMachineName: *const u16, // LPCWSTR optional
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", CharSet = CharSet.Unicode)]
public static extern bool AssociateColorProfileWithDeviceW([MarshalAs(UnmanagedType.LPWStr)] string pMachineName, [MarshalAs(UnmanagedType.LPWStr)] string pProfileName, [MarshalAs(UnmanagedType.LPWStr)] string pDeviceName);
"@
$api = Add-Type -MemberDefinition $sig -Name 'mscms_AssociateColorProfileWithDeviceW' -Namespace Win32 -PassThru
# $api::AssociateColorProfileWithDeviceW(pMachineName, pProfileName, pDeviceName)#uselib "mscms.dll"
#func global AssociateColorProfileWithDeviceW "AssociateColorProfileWithDeviceW" wptr, wptr, wptr
; AssociateColorProfileWithDeviceW pMachineName, pProfileName, pDeviceName ; 戻り値は stat
; pMachineName : LPCWSTR optional -> "wptr"
; pProfileName : LPCWSTR -> "wptr"
; pDeviceName : LPCWSTR -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "mscms.dll"
#cfunc global AssociateColorProfileWithDeviceW "AssociateColorProfileWithDeviceW" wstr, wstr, wstr
; res = AssociateColorProfileWithDeviceW(pMachineName, pProfileName, pDeviceName)
; pMachineName : LPCWSTR optional -> "wstr"
; pProfileName : LPCWSTR -> "wstr"
; pDeviceName : LPCWSTR -> "wstr"; BOOL AssociateColorProfileWithDeviceW(LPCWSTR pMachineName, LPCWSTR pProfileName, LPCWSTR pDeviceName)
#uselib "mscms.dll"
#cfunc global AssociateColorProfileWithDeviceW "AssociateColorProfileWithDeviceW" wstr, wstr, wstr
; res = AssociateColorProfileWithDeviceW(pMachineName, pProfileName, pDeviceName)
; pMachineName : LPCWSTR optional -> "wstr"
; pProfileName : LPCWSTR -> "wstr"
; pDeviceName : LPCWSTR -> "wstr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
mscms = windows.NewLazySystemDLL("mscms.dll")
procAssociateColorProfileWithDeviceW = mscms.NewProc("AssociateColorProfileWithDeviceW")
)
// pMachineName (LPCWSTR optional), pProfileName (LPCWSTR), pDeviceName (LPCWSTR)
r1, _, err := procAssociateColorProfileWithDeviceW.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pMachineName))),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pProfileName))),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pDeviceName))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction AssociateColorProfileWithDeviceW(
pMachineName: PWideChar; // LPCWSTR optional
pProfileName: PWideChar; // LPCWSTR
pDeviceName: PWideChar // LPCWSTR
): BOOL; stdcall;
external 'mscms.dll' name 'AssociateColorProfileWithDeviceW';result := DllCall("mscms\AssociateColorProfileWithDeviceW"
, "WStr", pMachineName ; LPCWSTR optional
, "WStr", pProfileName ; LPCWSTR
, "WStr", pDeviceName ; LPCWSTR
, "Int") ; return: BOOL●AssociateColorProfileWithDeviceW(pMachineName, pProfileName, pDeviceName) = DLL("mscms.dll", "bool AssociateColorProfileWithDeviceW(char*, char*, char*)")
# 呼び出し: AssociateColorProfileWithDeviceW(pMachineName, pProfileName, pDeviceName)
# pMachineName : LPCWSTR optional -> "char*"
# pProfileName : LPCWSTR -> "char*"
# pDeviceName : LPCWSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。