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

ColorProfileGetDisplayList

関数
ディスプレイに関連付けられたプロファイル一覧を取得する。
DLLmscms.dll呼出規約winapi

シグネチャ

// mscms.dll
#include <windows.h>

HRESULT ColorProfileGetDisplayList(
    WCS_PROFILE_MANAGEMENT_SCOPE scope,
    LUID targetAdapterID,
    DWORD sourceID,
    LPWSTR** profileList,
    DWORD* profileCount
);

パラメーター

名前方向
scopeWCS_PROFILE_MANAGEMENT_SCOPEin
targetAdapterIDLUIDin
sourceIDDWORDin
profileListLPWSTR**out
profileCountDWORD*out

戻り値の型: HRESULT

各言語での呼び出し定義

// mscms.dll
#include <windows.h>

HRESULT ColorProfileGetDisplayList(
    WCS_PROFILE_MANAGEMENT_SCOPE scope,
    LUID targetAdapterID,
    DWORD sourceID,
    LPWSTR** profileList,
    DWORD* profileCount
);
[DllImport("mscms.dll", ExactSpelling = true)]
static extern int ColorProfileGetDisplayList(
    int scope,   // WCS_PROFILE_MANAGEMENT_SCOPE
    LUID targetAdapterID,   // LUID
    uint sourceID,   // DWORD
    IntPtr profileList,   // LPWSTR** out
    out uint profileCount   // DWORD* out
);
<DllImport("mscms.dll", ExactSpelling:=True)>
Public Shared Function ColorProfileGetDisplayList(
    scope As Integer,   ' WCS_PROFILE_MANAGEMENT_SCOPE
    targetAdapterID As LUID,   ' LUID
    sourceID As UInteger,   ' DWORD
    profileList As IntPtr,   ' LPWSTR** out
    <Out> ByRef profileCount As UInteger   ' DWORD* out
) As Integer
End Function
' scope : WCS_PROFILE_MANAGEMENT_SCOPE
' targetAdapterID : LUID
' sourceID : DWORD
' profileList : LPWSTR** out
' profileCount : DWORD* out
Declare PtrSafe Function ColorProfileGetDisplayList Lib "mscms" ( _
    ByVal scope As Long, _
    ByVal targetAdapterID As LongPtr, _
    ByVal sourceID As Long, _
    ByVal profileList As LongPtr, _
    ByRef profileCount As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

ColorProfileGetDisplayList = ctypes.windll.mscms.ColorProfileGetDisplayList
ColorProfileGetDisplayList.restype = ctypes.c_int
ColorProfileGetDisplayList.argtypes = [
    ctypes.c_int,  # scope : WCS_PROFILE_MANAGEMENT_SCOPE
    LUID,  # targetAdapterID : LUID
    wintypes.DWORD,  # sourceID : DWORD
    ctypes.c_void_p,  # profileList : LPWSTR** out
    ctypes.POINTER(wintypes.DWORD),  # profileCount : DWORD* out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('mscms.dll')
ColorProfileGetDisplayList = Fiddle::Function.new(
  lib['ColorProfileGetDisplayList'],
  [
    Fiddle::TYPE_INT,  # scope : WCS_PROFILE_MANAGEMENT_SCOPE
    Fiddle::TYPE_VOIDP,  # targetAdapterID : LUID
    -Fiddle::TYPE_INT,  # sourceID : DWORD
    Fiddle::TYPE_VOIDP,  # profileList : LPWSTR** out
    Fiddle::TYPE_VOIDP,  # profileCount : DWORD* out
  ],
  Fiddle::TYPE_INT)
#[link(name = "mscms")]
extern "system" {
    fn ColorProfileGetDisplayList(
        scope: i32,  // WCS_PROFILE_MANAGEMENT_SCOPE
        targetAdapterID: LUID,  // LUID
        sourceID: u32,  // DWORD
        profileList: *mut *mut *mut u16,  // LPWSTR** out
        profileCount: *mut u32  // DWORD* out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("mscms.dll")]
public static extern int ColorProfileGetDisplayList(int scope, LUID targetAdapterID, uint sourceID, IntPtr profileList, out uint profileCount);
"@
$api = Add-Type -MemberDefinition $sig -Name 'mscms_ColorProfileGetDisplayList' -Namespace Win32 -PassThru
# $api::ColorProfileGetDisplayList(scope, targetAdapterID, sourceID, profileList, profileCount)
#uselib "mscms.dll"
#func global ColorProfileGetDisplayList "ColorProfileGetDisplayList" sptr, sptr, sptr, sptr, sptr
; ColorProfileGetDisplayList scope, targetAdapterID, sourceID, varptr(profileList), varptr(profileCount)   ; 戻り値は stat
; scope : WCS_PROFILE_MANAGEMENT_SCOPE -> "sptr"
; targetAdapterID : LUID -> "sptr"
; sourceID : DWORD -> "sptr"
; profileList : LPWSTR** out -> "sptr"
; profileCount : DWORD* out -> "sptr"
; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "mscms.dll"
#cfunc global ColorProfileGetDisplayList "ColorProfileGetDisplayList" int, int, int, var, var
; res = ColorProfileGetDisplayList(scope, targetAdapterID, sourceID, profileList, profileCount)
; scope : WCS_PROFILE_MANAGEMENT_SCOPE -> "int"
; targetAdapterID : LUID -> "int"
; sourceID : DWORD -> "int"
; profileList : LPWSTR** out -> "var"
; profileCount : DWORD* out -> "var"
; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HRESULT ColorProfileGetDisplayList(WCS_PROFILE_MANAGEMENT_SCOPE scope, LUID targetAdapterID, DWORD sourceID, LPWSTR** profileList, DWORD* profileCount)
#uselib "mscms.dll"
#cfunc global ColorProfileGetDisplayList "ColorProfileGetDisplayList" int, int, int, var, var
; res = ColorProfileGetDisplayList(scope, targetAdapterID, sourceID, profileList, profileCount)
; scope : WCS_PROFILE_MANAGEMENT_SCOPE -> "int"
; targetAdapterID : LUID -> "int"
; sourceID : DWORD -> "int"
; profileList : LPWSTR** out -> "var"
; profileCount : DWORD* out -> "var"
; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	mscms = windows.NewLazySystemDLL("mscms.dll")
	procColorProfileGetDisplayList = mscms.NewProc("ColorProfileGetDisplayList")
)

// scope (WCS_PROFILE_MANAGEMENT_SCOPE), targetAdapterID (LUID), sourceID (DWORD), profileList (LPWSTR** out), profileCount (DWORD* out)
r1, _, err := procColorProfileGetDisplayList.Call(
	uintptr(scope),
	uintptr(targetAdapterID),
	uintptr(sourceID),
	uintptr(profileList),
	uintptr(profileCount),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function ColorProfileGetDisplayList(
  scope: Integer;   // WCS_PROFILE_MANAGEMENT_SCOPE
  targetAdapterID: LUID;   // LUID
  sourceID: DWORD;   // DWORD
  profileList: PPWideChar;   // LPWSTR** out
  profileCount: Pointer   // DWORD* out
): Integer; stdcall;
  external 'mscms.dll' name 'ColorProfileGetDisplayList';
result := DllCall("mscms\ColorProfileGetDisplayList"
    , "Int", scope   ; WCS_PROFILE_MANAGEMENT_SCOPE
    , "Ptr", targetAdapterID   ; LUID
    , "UInt", sourceID   ; DWORD
    , "Ptr", profileList   ; LPWSTR** out
    , "Ptr", profileCount   ; DWORD* out
    , "Int")   ; return: HRESULT
●ColorProfileGetDisplayList(scope, targetAdapterID, sourceID, profileList, profileCount) = DLL("mscms.dll", "int ColorProfileGetDisplayList(int, void*, dword, void*, void*)")
# 呼び出し: ColorProfileGetDisplayList(scope, targetAdapterID, sourceID, profileList, profileCount)
# scope : WCS_PROFILE_MANAGEMENT_SCOPE -> "int"
# targetAdapterID : LUID -> "void*"
# sourceID : DWORD -> "dword"
# profileList : LPWSTR** out -> "void*"
# profileCount : DWORD* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。