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

SetStandardColorSpaceProfileA

関数
標準色空間の既定プロファイルを設定する(ANSI版)。
DLLmscms.dll文字セットANSI (-A)呼出規約winapi

シグネチャ

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

BOOL SetStandardColorSpaceProfileA(
    LPCSTR pMachineName,   // optional
    DWORD dwProfileID,
    LPCSTR pProfilename
);

パラメーター

名前方向
pMachineNameLPCSTRinoptional
dwProfileIDDWORDin
pProfilenameLPCSTRin

戻り値の型: BOOL

各言語での呼び出し定義

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

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

SetStandardColorSpaceProfileA = ctypes.windll.mscms.SetStandardColorSpaceProfileA
SetStandardColorSpaceProfileA.restype = wintypes.BOOL
SetStandardColorSpaceProfileA.argtypes = [
    wintypes.LPCSTR,  # pMachineName : LPCSTR optional
    wintypes.DWORD,  # dwProfileID : DWORD
    wintypes.LPCSTR,  # pProfilename : LPCSTR
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('mscms.dll')
SetStandardColorSpaceProfileA = Fiddle::Function.new(
  lib['SetStandardColorSpaceProfileA'],
  [
    Fiddle::TYPE_VOIDP,  # pMachineName : LPCSTR optional
    -Fiddle::TYPE_INT,  # dwProfileID : DWORD
    Fiddle::TYPE_VOIDP,  # pProfilename : LPCSTR
  ],
  Fiddle::TYPE_INT)
#[link(name = "mscms")]
extern "system" {
    fn SetStandardColorSpaceProfileA(
        pMachineName: *const u8,  // LPCSTR optional
        dwProfileID: u32,  // DWORD
        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 SetStandardColorSpaceProfileA([MarshalAs(UnmanagedType.LPStr)] string pMachineName, uint dwProfileID, [MarshalAs(UnmanagedType.LPStr)] string pProfilename);
"@
$api = Add-Type -MemberDefinition $sig -Name 'mscms_SetStandardColorSpaceProfileA' -Namespace Win32 -PassThru
# $api::SetStandardColorSpaceProfileA(pMachineName, dwProfileID, pProfilename)
#uselib "mscms.dll"
#func global SetStandardColorSpaceProfileA "SetStandardColorSpaceProfileA" sptr, sptr, sptr
; SetStandardColorSpaceProfileA pMachineName, dwProfileID, pProfilename   ; 戻り値は stat
; pMachineName : LPCSTR optional -> "sptr"
; dwProfileID : DWORD -> "sptr"
; pProfilename : LPCSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "mscms.dll"
#cfunc global SetStandardColorSpaceProfileA "SetStandardColorSpaceProfileA" str, int, str
; res = SetStandardColorSpaceProfileA(pMachineName, dwProfileID, pProfilename)
; pMachineName : LPCSTR optional -> "str"
; dwProfileID : DWORD -> "int"
; pProfilename : LPCSTR -> "str"
; BOOL SetStandardColorSpaceProfileA(LPCSTR pMachineName, DWORD dwProfileID, LPCSTR pProfilename)
#uselib "mscms.dll"
#cfunc global SetStandardColorSpaceProfileA "SetStandardColorSpaceProfileA" str, int, str
; res = SetStandardColorSpaceProfileA(pMachineName, dwProfileID, pProfilename)
; pMachineName : LPCSTR optional -> "str"
; dwProfileID : DWORD -> "int"
; pProfilename : LPCSTR -> "str"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	mscms = windows.NewLazySystemDLL("mscms.dll")
	procSetStandardColorSpaceProfileA = mscms.NewProc("SetStandardColorSpaceProfileA")
)

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