ホーム › UI.ColorSystem › ColorProfileRemoveDisplayAssociation
ColorProfileRemoveDisplayAssociation
関数ディスプレイへのカラープロファイル関連付けを解除する。
シグネチャ
// mscms.dll
#include <windows.h>
HRESULT ColorProfileRemoveDisplayAssociation(
WCS_PROFILE_MANAGEMENT_SCOPE scope,
LPCWSTR profileName,
LUID targetAdapterID,
DWORD sourceID,
BOOL dissociateAdvancedColor
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| scope | WCS_PROFILE_MANAGEMENT_SCOPE | in | 操作対象の管理範囲(システム全体/現在ユーザー)を示すWCSスコープ列挙値。 |
| profileName | LPCWSTR | in | 関連付けを解除するカラープロファイル名を指すワイド文字列ポインタ。 |
| targetAdapterID | LUID | in | 対象ディスプレイのアダプタを識別するLUID値。 |
| sourceID | DWORD | in | アダプタ上の対象ソース(出力)を識別するID。 |
| dissociateAdvancedColor | BOOL | in | TRUEで拡張色プロファイルとしての関連付けを解除するかを指定するフラグ。 |
戻り値の型: 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 // HRESULTfunction 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)。const std = @import("std");
extern "mscms" fn ColorProfileRemoveDisplayAssociation(
scope: i32, // WCS_PROFILE_MANAGEMENT_SCOPE
profileName: [*c]const u16, // LPCWSTR
targetAdapterID: LUID, // LUID
sourceID: u32, // DWORD
dissociateAdvancedColor: i32 // BOOL
) callconv(std.os.windows.WINAPI) i32;proc ColorProfileRemoveDisplayAssociation(
scope: int32, # WCS_PROFILE_MANAGEMENT_SCOPE
profileName: WideCString, # LPCWSTR
targetAdapterID: LUID, # LUID
sourceID: uint32, # DWORD
dissociateAdvancedColor: int32 # BOOL
): int32 {.importc: "ColorProfileRemoveDisplayAssociation", stdcall, dynlib: "mscms.dll".}pragma(lib, "mscms");
extern(Windows)
int ColorProfileRemoveDisplayAssociation(
int scope, // WCS_PROFILE_MANAGEMENT_SCOPE
const(wchar)* profileName, // LPCWSTR
LUID targetAdapterID, // LUID
uint sourceID, // DWORD
int dissociateAdvancedColor // BOOL
);ccall((:ColorProfileRemoveDisplayAssociation, "mscms.dll"), stdcall, Int32,
(Int32, Cwstring, LUID, UInt32, Int32),
scope, profileName, targetAdapterID, sourceID, dissociateAdvancedColor)
# scope : WCS_PROFILE_MANAGEMENT_SCOPE -> Int32
# profileName : LPCWSTR -> Cwstring
# targetAdapterID : LUID -> LUID
# sourceID : DWORD -> UInt32
# dissociateAdvancedColor : BOOL -> Int32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t ColorProfileRemoveDisplayAssociation(
int32_t scope,
const uint16_t* profileName,
LUID targetAdapterID,
uint32_t sourceID,
int32_t dissociateAdvancedColor);
]]
local mscms = ffi.load("mscms")
-- mscms.ColorProfileRemoveDisplayAssociation(scope, profileName, targetAdapterID, sourceID, dissociateAdvancedColor)
-- scope : WCS_PROFILE_MANAGEMENT_SCOPE
-- profileName : LPCWSTR
-- targetAdapterID : LUID
-- sourceID : DWORD
-- dissociateAdvancedColor : BOOL
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('mscms.dll');
const ColorProfileRemoveDisplayAssociation = lib.func('__stdcall', 'ColorProfileRemoveDisplayAssociation', 'int32_t', ['int32_t', 'str16', 'LUID', 'uint32_t', 'int32_t']);
// ColorProfileRemoveDisplayAssociation(scope, profileName, targetAdapterID, sourceID, dissociateAdvancedColor)
// scope : WCS_PROFILE_MANAGEMENT_SCOPE -> 'int32_t'
// profileName : LPCWSTR -> 'str16'
// targetAdapterID : LUID -> 'LUID'
// sourceID : DWORD -> 'uint32_t'
// dissociateAdvancedColor : BOOL -> 'int32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("mscms.dll", {
ColorProfileRemoveDisplayAssociation: { parameters: ["i32", "buffer", "buffer", "u32", "i32"], result: "i32" },
});
// lib.symbols.ColorProfileRemoveDisplayAssociation(scope, profileName, targetAdapterID, sourceID, dissociateAdvancedColor)
// scope : WCS_PROFILE_MANAGEMENT_SCOPE -> "i32"
// profileName : LPCWSTR -> "buffer"
// targetAdapterID : LUID -> "buffer"
// sourceID : DWORD -> "u32"
// dissociateAdvancedColor : BOOL -> "i32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t ColorProfileRemoveDisplayAssociation(
int32_t scope,
const uint16_t* profileName,
LUID targetAdapterID,
uint32_t sourceID,
int32_t dissociateAdvancedColor);
C, "mscms.dll");
// $ffi->ColorProfileRemoveDisplayAssociation(scope, profileName, targetAdapterID, sourceID, dissociateAdvancedColor);
// scope : WCS_PROFILE_MANAGEMENT_SCOPE
// profileName : LPCWSTR
// targetAdapterID : LUID
// sourceID : DWORD
// dissociateAdvancedColor : BOOL
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Mscms extends StdCallLibrary {
Mscms INSTANCE = Native.load("mscms", Mscms.class);
int ColorProfileRemoveDisplayAssociation(
int scope, // WCS_PROFILE_MANAGEMENT_SCOPE
WString profileName, // LPCWSTR
LUID /* extends Structure (by value) */ targetAdapterID, // LUID
int sourceID, // DWORD
boolean dissociateAdvancedColor // BOOL
);
}@[Link("mscms")]
lib Libmscms
fun ColorProfileRemoveDisplayAssociation = ColorProfileRemoveDisplayAssociation(
scope : Int32, # WCS_PROFILE_MANAGEMENT_SCOPE
profileName : UInt16*, # LPCWSTR
targetAdapterID : LUID, # LUID
sourceID : UInt32, # DWORD
dissociateAdvancedColor : Int32 # BOOL
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef ColorProfileRemoveDisplayAssociationNative = Int32 Function(Int32, Pointer<Utf16>, LUID, Uint32, Int32);
typedef ColorProfileRemoveDisplayAssociationDart = int Function(int, Pointer<Utf16>, int, int, int);
final ColorProfileRemoveDisplayAssociation = DynamicLibrary.open('mscms.dll')
.lookupFunction<ColorProfileRemoveDisplayAssociationNative, ColorProfileRemoveDisplayAssociationDart>('ColorProfileRemoveDisplayAssociation');
// scope : WCS_PROFILE_MANAGEMENT_SCOPE -> Int32
// profileName : LPCWSTR -> Pointer<Utf16>
// targetAdapterID : LUID -> LUID
// sourceID : DWORD -> Uint32
// dissociateAdvancedColor : BOOL -> Int32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
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';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "ColorProfileRemoveDisplayAssociation"
c_ColorProfileRemoveDisplayAssociation :: Int32 -> CWString -> LUID -> Word32 -> CInt -> IO Int32
-- scope : WCS_PROFILE_MANAGEMENT_SCOPE -> Int32
-- profileName : LPCWSTR -> CWString
-- targetAdapterID : LUID -> LUID
-- sourceID : DWORD -> Word32
-- dissociateAdvancedColor : BOOL -> CInt
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
-- ※値渡し構造体は GHC FFI で直接渡せません。Ptr で渡すラッパ(C側)経由にしてください。open Ctypes
open Foreign
let colorprofileremovedisplayassociation =
foreign "ColorProfileRemoveDisplayAssociation"
(int32_t @-> (ptr uint16_t) @-> LUID @-> uint32_t @-> int32_t @-> returning int32_t)
(* scope : WCS_PROFILE_MANAGEMENT_SCOPE -> int32_t *)
(* profileName : LPCWSTR -> (ptr uint16_t) *)
(* targetAdapterID : LUID -> LUID *)
(* sourceID : DWORD -> uint32_t *)
(* dissociateAdvancedColor : BOOL -> int32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library mscms (t "mscms.dll"))
(cffi:use-foreign-library mscms)
(cffi:defcfun ("ColorProfileRemoveDisplayAssociation" color-profile-remove-display-association :convention :stdcall) :int32
(scope :int32) ; WCS_PROFILE_MANAGEMENT_SCOPE
(profile-name (:string :encoding :utf-16le)) ; LPCWSTR
(target-adapter-id (:struct luid)) ; LUID
(source-id :uint32) ; DWORD
(dissociate-advanced-color :int32)) ; BOOL
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $ColorProfileRemoveDisplayAssociation = Win32::API::More->new('mscms',
'int ColorProfileRemoveDisplayAssociation(int scope, LPCWSTR profileName, LPVOID targetAdapterID, DWORD sourceID, BOOL dissociateAdvancedColor)');
# my $ret = $ColorProfileRemoveDisplayAssociation->Call($scope, $profileName, $targetAdapterID, $sourceID, $dissociateAdvancedColor);
# scope : WCS_PROFILE_MANAGEMENT_SCOPE -> int
# profileName : LPCWSTR -> LPCWSTR
# targetAdapterID : LUID -> LPVOID
# sourceID : DWORD -> DWORD
# dissociateAdvancedColor : BOOL -> BOOL
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。