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

InstallColorProfileA

関数
カラープロファイルをシステムに導入する(ANSI版)。
DLLmscms.dll文字セットANSI (-A)呼出規約winapi

シグネチャ

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

BOOL InstallColorProfileA(
    LPCSTR pMachineName,   // optional
    LPCSTR pProfileName
);

パラメーター

名前方向
pMachineNameLPCSTRinoptional
pProfileNameLPCSTRin

戻り値の型: BOOL

各言語での呼び出し定義

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

BOOL InstallColorProfileA(
    LPCSTR pMachineName,   // optional
    LPCSTR pProfileName
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("mscms.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern bool InstallColorProfileA(
    [MarshalAs(UnmanagedType.LPStr)] string pMachineName,   // LPCSTR optional
    [MarshalAs(UnmanagedType.LPStr)] string pProfileName   // LPCSTR
);
<DllImport("mscms.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function InstallColorProfileA(
    <MarshalAs(UnmanagedType.LPStr)> pMachineName As String,   ' LPCSTR optional
    <MarshalAs(UnmanagedType.LPStr)> pProfileName As String   ' LPCSTR
) As Boolean
End Function
' pMachineName : LPCSTR optional
' pProfileName : LPCSTR
Declare PtrSafe Function InstallColorProfileA Lib "mscms" ( _
    ByVal pMachineName As String, _
    ByVal pProfileName As String) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

InstallColorProfileA = ctypes.windll.mscms.InstallColorProfileA
InstallColorProfileA.restype = wintypes.BOOL
InstallColorProfileA.argtypes = [
    wintypes.LPCSTR,  # pMachineName : LPCSTR optional
    wintypes.LPCSTR,  # pProfileName : LPCSTR
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('mscms.dll')
InstallColorProfileA = Fiddle::Function.new(
  lib['InstallColorProfileA'],
  [
    Fiddle::TYPE_VOIDP,  # pMachineName : LPCSTR optional
    Fiddle::TYPE_VOIDP,  # pProfileName : LPCSTR
  ],
  Fiddle::TYPE_INT)
#[link(name = "mscms")]
extern "system" {
    fn InstallColorProfileA(
        pMachineName: *const u8,  // LPCSTR optional
        pProfileName: *const u8  // LPCSTR
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("mscms.dll", CharSet = CharSet.Ansi)]
public static extern bool InstallColorProfileA([MarshalAs(UnmanagedType.LPStr)] string pMachineName, [MarshalAs(UnmanagedType.LPStr)] string pProfileName);
"@
$api = Add-Type -MemberDefinition $sig -Name 'mscms_InstallColorProfileA' -Namespace Win32 -PassThru
# $api::InstallColorProfileA(pMachineName, pProfileName)
#uselib "mscms.dll"
#func global InstallColorProfileA "InstallColorProfileA" sptr, sptr
; InstallColorProfileA pMachineName, pProfileName   ; 戻り値は stat
; pMachineName : LPCSTR optional -> "sptr"
; pProfileName : LPCSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "mscms.dll"
#cfunc global InstallColorProfileA "InstallColorProfileA" str, str
; res = InstallColorProfileA(pMachineName, pProfileName)
; pMachineName : LPCSTR optional -> "str"
; pProfileName : LPCSTR -> "str"
; BOOL InstallColorProfileA(LPCSTR pMachineName, LPCSTR pProfileName)
#uselib "mscms.dll"
#cfunc global InstallColorProfileA "InstallColorProfileA" str, str
; res = InstallColorProfileA(pMachineName, pProfileName)
; pMachineName : LPCSTR optional -> "str"
; pProfileName : LPCSTR -> "str"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	mscms = windows.NewLazySystemDLL("mscms.dll")
	procInstallColorProfileA = mscms.NewProc("InstallColorProfileA")
)

// pMachineName (LPCSTR optional), pProfileName (LPCSTR)
r1, _, err := procInstallColorProfileA.Call(
	uintptr(unsafe.Pointer(windows.BytePtrFromString(pMachineName))),
	uintptr(unsafe.Pointer(windows.BytePtrFromString(pProfileName))),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function InstallColorProfileA(
  pMachineName: PAnsiChar;   // LPCSTR optional
  pProfileName: PAnsiChar   // LPCSTR
): BOOL; stdcall;
  external 'mscms.dll' name 'InstallColorProfileA';
result := DllCall("mscms\InstallColorProfileA"
    , "AStr", pMachineName   ; LPCSTR optional
    , "AStr", pProfileName   ; LPCSTR
    , "Int")   ; return: BOOL
●InstallColorProfileA(pMachineName, pProfileName) = DLL("mscms.dll", "bool InstallColorProfileA(char*, char*)")
# 呼び出し: InstallColorProfileA(pMachineName, pProfileName)
# pMachineName : LPCSTR optional -> "char*"
# pProfileName : LPCSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。