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

GetStandardColorSpaceProfileW

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

シグネチャ

// mscms.dll  (Unicode / -W)
#include <windows.h>

BOOL GetStandardColorSpaceProfileW(
    LPCWSTR pMachineName,   // optional
    DWORD dwSCS,
    LPWSTR pBuffer,   // optional
    DWORD* pcbSize
);

パラメーター

名前方向
pMachineNameLPCWSTRinoptional
dwSCSDWORDin
pBufferLPWSTRoutoptional
pcbSizeDWORD*inout

戻り値の型: BOOL

各言語での呼び出し定義

// mscms.dll  (Unicode / -W)
#include <windows.h>

BOOL GetStandardColorSpaceProfileW(
    LPCWSTR pMachineName,   // optional
    DWORD dwSCS,
    LPWSTR pBuffer,   // optional
    DWORD* pcbSize
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("mscms.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern bool GetStandardColorSpaceProfileW(
    [MarshalAs(UnmanagedType.LPWStr)] string pMachineName,   // LPCWSTR optional
    uint dwSCS,   // DWORD
    [MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder pBuffer,   // LPWSTR optional, out
    ref uint pcbSize   // DWORD* in/out
);
<DllImport("mscms.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function GetStandardColorSpaceProfileW(
    <MarshalAs(UnmanagedType.LPWStr)> pMachineName As String,   ' LPCWSTR optional
    dwSCS As UInteger,   ' DWORD
    <MarshalAs(UnmanagedType.LPWStr)> pBuffer As System.Text.StringBuilder,   ' LPWSTR optional, out
    ByRef pcbSize As UInteger   ' DWORD* in/out
) As Boolean
End Function
' pMachineName : LPCWSTR optional
' dwSCS : DWORD
' pBuffer : LPWSTR optional, out
' pcbSize : DWORD* in/out
Declare PtrSafe Function GetStandardColorSpaceProfileW Lib "mscms" ( _
    ByVal pMachineName As LongPtr, _
    ByVal dwSCS As Long, _
    ByVal pBuffer As LongPtr, _
    ByRef pcbSize As Long) 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

GetStandardColorSpaceProfileW = ctypes.windll.mscms.GetStandardColorSpaceProfileW
GetStandardColorSpaceProfileW.restype = wintypes.BOOL
GetStandardColorSpaceProfileW.argtypes = [
    wintypes.LPCWSTR,  # pMachineName : LPCWSTR optional
    wintypes.DWORD,  # dwSCS : DWORD
    wintypes.LPWSTR,  # pBuffer : LPWSTR optional, out
    ctypes.POINTER(wintypes.DWORD),  # pcbSize : DWORD* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('mscms.dll')
GetStandardColorSpaceProfileW = Fiddle::Function.new(
  lib['GetStandardColorSpaceProfileW'],
  [
    Fiddle::TYPE_VOIDP,  # pMachineName : LPCWSTR optional
    -Fiddle::TYPE_INT,  # dwSCS : DWORD
    Fiddle::TYPE_VOIDP,  # pBuffer : LPWSTR optional, out
    Fiddle::TYPE_VOIDP,  # pcbSize : DWORD* in/out
  ],
  Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"
#[link(name = "mscms")]
extern "system" {
    fn GetStandardColorSpaceProfileW(
        pMachineName: *const u16,  // LPCWSTR optional
        dwSCS: u32,  // DWORD
        pBuffer: *mut u16,  // LPWSTR optional, out
        pcbSize: *mut u32  // DWORD* in/out
    ) -> 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 GetStandardColorSpaceProfileW([MarshalAs(UnmanagedType.LPWStr)] string pMachineName, uint dwSCS, [MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder pBuffer, ref uint pcbSize);
"@
$api = Add-Type -MemberDefinition $sig -Name 'mscms_GetStandardColorSpaceProfileW' -Namespace Win32 -PassThru
# $api::GetStandardColorSpaceProfileW(pMachineName, dwSCS, pBuffer, pcbSize)
#uselib "mscms.dll"
#func global GetStandardColorSpaceProfileW "GetStandardColorSpaceProfileW" wptr, wptr, wptr, wptr
; GetStandardColorSpaceProfileW pMachineName, dwSCS, varptr(pBuffer), varptr(pcbSize)   ; 戻り値は stat
; pMachineName : LPCWSTR optional -> "wptr"
; dwSCS : DWORD -> "wptr"
; pBuffer : LPWSTR optional, out -> "wptr"
; pcbSize : DWORD* in/out -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "mscms.dll"
#cfunc global GetStandardColorSpaceProfileW "GetStandardColorSpaceProfileW" wstr, int, var, var
; res = GetStandardColorSpaceProfileW(pMachineName, dwSCS, pBuffer, pcbSize)
; pMachineName : LPCWSTR optional -> "wstr"
; dwSCS : DWORD -> "int"
; pBuffer : LPWSTR optional, out -> "var"
; pcbSize : DWORD* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; BOOL GetStandardColorSpaceProfileW(LPCWSTR pMachineName, DWORD dwSCS, LPWSTR pBuffer, DWORD* pcbSize)
#uselib "mscms.dll"
#cfunc global GetStandardColorSpaceProfileW "GetStandardColorSpaceProfileW" wstr, int, var, var
; res = GetStandardColorSpaceProfileW(pMachineName, dwSCS, pBuffer, pcbSize)
; pMachineName : LPCWSTR optional -> "wstr"
; dwSCS : DWORD -> "int"
; pBuffer : LPWSTR optional, out -> "var"
; pcbSize : DWORD* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	mscms = windows.NewLazySystemDLL("mscms.dll")
	procGetStandardColorSpaceProfileW = mscms.NewProc("GetStandardColorSpaceProfileW")
)

// pMachineName (LPCWSTR optional), dwSCS (DWORD), pBuffer (LPWSTR optional, out), pcbSize (DWORD* in/out)
r1, _, err := procGetStandardColorSpaceProfileW.Call(
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pMachineName))),
	uintptr(dwSCS),
	uintptr(pBuffer),
	uintptr(pcbSize),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function GetStandardColorSpaceProfileW(
  pMachineName: PWideChar;   // LPCWSTR optional
  dwSCS: DWORD;   // DWORD
  pBuffer: PWideChar;   // LPWSTR optional, out
  pcbSize: Pointer   // DWORD* in/out
): BOOL; stdcall;
  external 'mscms.dll' name 'GetStandardColorSpaceProfileW';
result := DllCall("mscms\GetStandardColorSpaceProfileW"
    , "WStr", pMachineName   ; LPCWSTR optional
    , "UInt", dwSCS   ; DWORD
    , "Ptr", pBuffer   ; LPWSTR optional, out
    , "Ptr", pcbSize   ; DWORD* in/out
    , "Int")   ; return: BOOL
●GetStandardColorSpaceProfileW(pMachineName, dwSCS, pBuffer, pcbSize) = DLL("mscms.dll", "bool GetStandardColorSpaceProfileW(char*, dword, char*, void*)")
# 呼び出し: GetStandardColorSpaceProfileW(pMachineName, dwSCS, pBuffer, pcbSize)
# pMachineName : LPCWSTR optional -> "char*"
# dwSCS : DWORD -> "dword"
# pBuffer : LPWSTR optional, out -> "char*"
# pcbSize : DWORD* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。