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

ColorProfileRemoveDisplayAssociation

関数
ディスプレイへのカラープロファイル関連付けを解除する。
DLLmscms.dll呼出規約winapi

シグネチャ

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

HRESULT ColorProfileRemoveDisplayAssociation(
    WCS_PROFILE_MANAGEMENT_SCOPE scope,
    LPCWSTR profileName,
    LUID targetAdapterID,
    DWORD sourceID,
    BOOL dissociateAdvancedColor
);

パラメーター

名前方向
scopeWCS_PROFILE_MANAGEMENT_SCOPEin
profileNameLPCWSTRin
targetAdapterIDLUIDin
sourceIDDWORDin
dissociateAdvancedColorBOOLin

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT ColorProfileRemoveDisplayAssociation(
    WCS_PROFILE_MANAGEMENT_SCOPE scope,
    LPCWSTR profileName,
    LUID targetAdapterID,
    DWORD sourceID,
    BOOL dissociateAdvancedColor
);
[DllImport("mscms.dll", ExactSpelling = true)]
static extern int ColorProfileRemoveDisplayAssociation(
    int scope,   // WCS_PROFILE_MANAGEMENT_SCOPE
    [MarshalAs(UnmanagedType.LPWStr)] string profileName,   // LPCWSTR
    LUID targetAdapterID,   // LUID
    uint sourceID,   // DWORD
    bool dissociateAdvancedColor   // BOOL
);
<DllImport("mscms.dll", ExactSpelling:=True)>
Public Shared Function ColorProfileRemoveDisplayAssociation(
    scope As Integer,   ' WCS_PROFILE_MANAGEMENT_SCOPE
    <MarshalAs(UnmanagedType.LPWStr)> profileName As String,   ' LPCWSTR
    targetAdapterID As LUID,   ' LUID
    sourceID As UInteger,   ' DWORD
    dissociateAdvancedColor As Boolean   ' BOOL
) As Integer
End Function
' scope : WCS_PROFILE_MANAGEMENT_SCOPE
' profileName : LPCWSTR
' targetAdapterID : LUID
' sourceID : DWORD
' dissociateAdvancedColor : BOOL
Declare PtrSafe Function ColorProfileRemoveDisplayAssociation Lib "mscms" ( _
    ByVal scope As Long, _
    ByVal profileName As LongPtr, _
    ByVal targetAdapterID As LongPtr, _
    ByVal sourceID As Long, _
    ByVal dissociateAdvancedColor As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

ColorProfileRemoveDisplayAssociation = ctypes.windll.mscms.ColorProfileRemoveDisplayAssociation
ColorProfileRemoveDisplayAssociation.restype = ctypes.c_int
ColorProfileRemoveDisplayAssociation.argtypes = [
    ctypes.c_int,  # scope : WCS_PROFILE_MANAGEMENT_SCOPE
    wintypes.LPCWSTR,  # profileName : LPCWSTR
    LUID,  # targetAdapterID : LUID
    wintypes.DWORD,  # sourceID : DWORD
    wintypes.BOOL,  # dissociateAdvancedColor : BOOL
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('mscms.dll')
ColorProfileRemoveDisplayAssociation = Fiddle::Function.new(
  lib['ColorProfileRemoveDisplayAssociation'],
  [
    Fiddle::TYPE_INT,  # scope : WCS_PROFILE_MANAGEMENT_SCOPE
    Fiddle::TYPE_VOIDP,  # profileName : LPCWSTR
    Fiddle::TYPE_VOIDP,  # targetAdapterID : LUID
    -Fiddle::TYPE_INT,  # sourceID : DWORD
    Fiddle::TYPE_INT,  # dissociateAdvancedColor : BOOL
  ],
  Fiddle::TYPE_INT)
#[link(name = "mscms")]
extern "system" {
    fn ColorProfileRemoveDisplayAssociation(
        scope: i32,  // WCS_PROFILE_MANAGEMENT_SCOPE
        profileName: *const u16,  // LPCWSTR
        targetAdapterID: LUID,  // LUID
        sourceID: u32,  // DWORD
        dissociateAdvancedColor: i32  // BOOL
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("mscms.dll")]
public static extern int ColorProfileRemoveDisplayAssociation(int scope, [MarshalAs(UnmanagedType.LPWStr)] string profileName, LUID targetAdapterID, uint sourceID, bool dissociateAdvancedColor);
"@
$api = Add-Type -MemberDefinition $sig -Name 'mscms_ColorProfileRemoveDisplayAssociation' -Namespace Win32 -PassThru
# $api::ColorProfileRemoveDisplayAssociation(scope, profileName, targetAdapterID, sourceID, dissociateAdvancedColor)
#uselib "mscms.dll"
#func global ColorProfileRemoveDisplayAssociation "ColorProfileRemoveDisplayAssociation" sptr, sptr, sptr, sptr, sptr
; ColorProfileRemoveDisplayAssociation scope, profileName, targetAdapterID, sourceID, dissociateAdvancedColor   ; 戻り値は stat
; scope : WCS_PROFILE_MANAGEMENT_SCOPE -> "sptr"
; profileName : LPCWSTR -> "sptr"
; targetAdapterID : LUID -> "sptr"
; sourceID : DWORD -> "sptr"
; dissociateAdvancedColor : BOOL -> "sptr"
; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "mscms.dll"
#cfunc global ColorProfileRemoveDisplayAssociation "ColorProfileRemoveDisplayAssociation" int, wstr, int, int, int
; res = ColorProfileRemoveDisplayAssociation(scope, profileName, targetAdapterID, sourceID, dissociateAdvancedColor)
; scope : WCS_PROFILE_MANAGEMENT_SCOPE -> "int"
; profileName : LPCWSTR -> "wstr"
; targetAdapterID : LUID -> "int"
; sourceID : DWORD -> "int"
; dissociateAdvancedColor : BOOL -> "int"
; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。
; HRESULT ColorProfileRemoveDisplayAssociation(WCS_PROFILE_MANAGEMENT_SCOPE scope, LPCWSTR profileName, LUID targetAdapterID, DWORD sourceID, BOOL dissociateAdvancedColor)
#uselib "mscms.dll"
#cfunc global ColorProfileRemoveDisplayAssociation "ColorProfileRemoveDisplayAssociation" int, wstr, int, int, int
; res = ColorProfileRemoveDisplayAssociation(scope, profileName, targetAdapterID, sourceID, dissociateAdvancedColor)
; scope : WCS_PROFILE_MANAGEMENT_SCOPE -> "int"
; profileName : LPCWSTR -> "wstr"
; targetAdapterID : LUID -> "int"
; sourceID : DWORD -> "int"
; dissociateAdvancedColor : BOOL -> "int"
; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	mscms = windows.NewLazySystemDLL("mscms.dll")
	procColorProfileRemoveDisplayAssociation = mscms.NewProc("ColorProfileRemoveDisplayAssociation")
)

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