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

WcsDisassociateColorProfileFromDevice

関数
WCSでプロファイルとデバイスの関連付けを解除する。
DLLmscms.dll呼出規約winapi

シグネチャ

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

BOOL WcsDisassociateColorProfileFromDevice(
    WCS_PROFILE_MANAGEMENT_SCOPE scope,
    LPCWSTR pProfileName,
    LPCWSTR pDeviceName
);

パラメーター

名前方向説明
scopeWCS_PROFILE_MANAGEMENT_SCOPEin操作対象の管理範囲(システム全体/現在ユーザー)を示すWCSスコープ列挙値。
pProfileNameLPCWSTRin関連付けを解除するカラープロファイル名を指すワイド文字列ポインタ。
pDeviceNameLPCWSTRin関連付けを解除する対象デバイス名を指すワイド文字列ポインタ。

戻り値の型: BOOL

各言語での呼び出し定義

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

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

WcsDisassociateColorProfileFromDevice = ctypes.windll.mscms.WcsDisassociateColorProfileFromDevice
WcsDisassociateColorProfileFromDevice.restype = wintypes.BOOL
WcsDisassociateColorProfileFromDevice.argtypes = [
    ctypes.c_int,  # scope : WCS_PROFILE_MANAGEMENT_SCOPE
    wintypes.LPCWSTR,  # pProfileName : LPCWSTR
    wintypes.LPCWSTR,  # pDeviceName : LPCWSTR
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('mscms.dll')
WcsDisassociateColorProfileFromDevice = Fiddle::Function.new(
  lib['WcsDisassociateColorProfileFromDevice'],
  [
    Fiddle::TYPE_INT,  # scope : WCS_PROFILE_MANAGEMENT_SCOPE
    Fiddle::TYPE_VOIDP,  # pProfileName : LPCWSTR
    Fiddle::TYPE_VOIDP,  # pDeviceName : LPCWSTR
  ],
  Fiddle::TYPE_INT)
#[link(name = "mscms")]
extern "system" {
    fn WcsDisassociateColorProfileFromDevice(
        scope: i32,  // WCS_PROFILE_MANAGEMENT_SCOPE
        pProfileName: *const u16,  // LPCWSTR
        pDeviceName: *const u16  // LPCWSTR
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("mscms.dll")]
public static extern bool WcsDisassociateColorProfileFromDevice(int scope, [MarshalAs(UnmanagedType.LPWStr)] string pProfileName, [MarshalAs(UnmanagedType.LPWStr)] string pDeviceName);
"@
$api = Add-Type -MemberDefinition $sig -Name 'mscms_WcsDisassociateColorProfileFromDevice' -Namespace Win32 -PassThru
# $api::WcsDisassociateColorProfileFromDevice(scope, pProfileName, pDeviceName)
#uselib "mscms.dll"
#func global WcsDisassociateColorProfileFromDevice "WcsDisassociateColorProfileFromDevice" sptr, sptr, sptr
; WcsDisassociateColorProfileFromDevice scope, pProfileName, pDeviceName   ; 戻り値は stat
; scope : WCS_PROFILE_MANAGEMENT_SCOPE -> "sptr"
; pProfileName : LPCWSTR -> "sptr"
; pDeviceName : LPCWSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "mscms.dll"
#cfunc global WcsDisassociateColorProfileFromDevice "WcsDisassociateColorProfileFromDevice" int, wstr, wstr
; res = WcsDisassociateColorProfileFromDevice(scope, pProfileName, pDeviceName)
; scope : WCS_PROFILE_MANAGEMENT_SCOPE -> "int"
; pProfileName : LPCWSTR -> "wstr"
; pDeviceName : LPCWSTR -> "wstr"
; BOOL WcsDisassociateColorProfileFromDevice(WCS_PROFILE_MANAGEMENT_SCOPE scope, LPCWSTR pProfileName, LPCWSTR pDeviceName)
#uselib "mscms.dll"
#cfunc global WcsDisassociateColorProfileFromDevice "WcsDisassociateColorProfileFromDevice" int, wstr, wstr
; res = WcsDisassociateColorProfileFromDevice(scope, pProfileName, pDeviceName)
; scope : WCS_PROFILE_MANAGEMENT_SCOPE -> "int"
; pProfileName : LPCWSTR -> "wstr"
; pDeviceName : LPCWSTR -> "wstr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	mscms = windows.NewLazySystemDLL("mscms.dll")
	procWcsDisassociateColorProfileFromDevice = mscms.NewProc("WcsDisassociateColorProfileFromDevice")
)

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

extern "mscms" fn WcsDisassociateColorProfileFromDevice(
    scope: i32, // WCS_PROFILE_MANAGEMENT_SCOPE
    pProfileName: [*c]const u16, // LPCWSTR
    pDeviceName: [*c]const u16 // LPCWSTR
) callconv(std.os.windows.WINAPI) i32;
proc WcsDisassociateColorProfileFromDevice(
    scope: int32,  # WCS_PROFILE_MANAGEMENT_SCOPE
    pProfileName: WideCString,  # LPCWSTR
    pDeviceName: WideCString  # LPCWSTR
): int32 {.importc: "WcsDisassociateColorProfileFromDevice", stdcall, dynlib: "mscms.dll".}
pragma(lib, "mscms");
extern(Windows)
int WcsDisassociateColorProfileFromDevice(
    int scope,   // WCS_PROFILE_MANAGEMENT_SCOPE
    const(wchar)* pProfileName,   // LPCWSTR
    const(wchar)* pDeviceName   // LPCWSTR
);
ccall((:WcsDisassociateColorProfileFromDevice, "mscms.dll"), stdcall, Int32,
      (Int32, Cwstring, Cwstring),
      scope, pProfileName, pDeviceName)
# scope : WCS_PROFILE_MANAGEMENT_SCOPE -> Int32
# pProfileName : LPCWSTR -> Cwstring
# pDeviceName : LPCWSTR -> Cwstring
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t WcsDisassociateColorProfileFromDevice(
    int32_t scope,
    const uint16_t* pProfileName,
    const uint16_t* pDeviceName);
]]
local mscms = ffi.load("mscms")
-- mscms.WcsDisassociateColorProfileFromDevice(scope, pProfileName, pDeviceName)
-- scope : WCS_PROFILE_MANAGEMENT_SCOPE
-- pProfileName : LPCWSTR
-- pDeviceName : LPCWSTR
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('mscms.dll');
const WcsDisassociateColorProfileFromDevice = lib.func('__stdcall', 'WcsDisassociateColorProfileFromDevice', 'int32_t', ['int32_t', 'str16', 'str16']);
// WcsDisassociateColorProfileFromDevice(scope, pProfileName, pDeviceName)
// scope : WCS_PROFILE_MANAGEMENT_SCOPE -> 'int32_t'
// pProfileName : LPCWSTR -> 'str16'
// pDeviceName : LPCWSTR -> 'str16'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("mscms.dll", {
  WcsDisassociateColorProfileFromDevice: { parameters: ["i32", "buffer", "buffer"], result: "i32" },
});
// lib.symbols.WcsDisassociateColorProfileFromDevice(scope, pProfileName, pDeviceName)
// scope : WCS_PROFILE_MANAGEMENT_SCOPE -> "i32"
// pProfileName : LPCWSTR -> "buffer"
// pDeviceName : LPCWSTR -> "buffer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t WcsDisassociateColorProfileFromDevice(
    int32_t scope,
    const uint16_t* pProfileName,
    const uint16_t* pDeviceName);
C, "mscms.dll");
// $ffi->WcsDisassociateColorProfileFromDevice(scope, pProfileName, pDeviceName);
// scope : WCS_PROFILE_MANAGEMENT_SCOPE
// pProfileName : LPCWSTR
// pDeviceName : LPCWSTR
// 構造体/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);
    boolean WcsDisassociateColorProfileFromDevice(
        int scope,   // WCS_PROFILE_MANAGEMENT_SCOPE
        WString pProfileName,   // LPCWSTR
        WString pDeviceName   // LPCWSTR
    );
}
@[Link("mscms")]
lib Libmscms
  fun WcsDisassociateColorProfileFromDevice = WcsDisassociateColorProfileFromDevice(
    scope : Int32,   # WCS_PROFILE_MANAGEMENT_SCOPE
    pProfileName : UInt16*,   # LPCWSTR
    pDeviceName : UInt16*   # LPCWSTR
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef WcsDisassociateColorProfileFromDeviceNative = Int32 Function(Int32, Pointer<Utf16>, Pointer<Utf16>);
typedef WcsDisassociateColorProfileFromDeviceDart = int Function(int, Pointer<Utf16>, Pointer<Utf16>);
final WcsDisassociateColorProfileFromDevice = DynamicLibrary.open('mscms.dll')
    .lookupFunction<WcsDisassociateColorProfileFromDeviceNative, WcsDisassociateColorProfileFromDeviceDart>('WcsDisassociateColorProfileFromDevice');
// scope : WCS_PROFILE_MANAGEMENT_SCOPE -> Int32
// pProfileName : LPCWSTR -> Pointer<Utf16>
// pDeviceName : LPCWSTR -> Pointer<Utf16>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function WcsDisassociateColorProfileFromDevice(
  scope: Integer;   // WCS_PROFILE_MANAGEMENT_SCOPE
  pProfileName: PWideChar;   // LPCWSTR
  pDeviceName: PWideChar   // LPCWSTR
): BOOL; stdcall;
  external 'mscms.dll' name 'WcsDisassociateColorProfileFromDevice';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "WcsDisassociateColorProfileFromDevice"
  c_WcsDisassociateColorProfileFromDevice :: Int32 -> CWString -> CWString -> IO CInt
-- scope : WCS_PROFILE_MANAGEMENT_SCOPE -> Int32
-- pProfileName : LPCWSTR -> CWString
-- pDeviceName : LPCWSTR -> CWString
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let wcsdisassociatecolorprofilefromdevice =
  foreign "WcsDisassociateColorProfileFromDevice"
    (int32_t @-> (ptr uint16_t) @-> (ptr uint16_t) @-> returning int32_t)
(* scope : WCS_PROFILE_MANAGEMENT_SCOPE -> int32_t *)
(* pProfileName : LPCWSTR -> (ptr uint16_t) *)
(* pDeviceName : LPCWSTR -> (ptr uint16_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library mscms (t "mscms.dll"))
(cffi:use-foreign-library mscms)

(cffi:defcfun ("WcsDisassociateColorProfileFromDevice" wcs-disassociate-color-profile-from-device :convention :stdcall) :int32
  (scope :int32)   ; WCS_PROFILE_MANAGEMENT_SCOPE
  (p-profile-name (:string :encoding :utf-16le))   ; LPCWSTR
  (p-device-name (:string :encoding :utf-16le)))   ; LPCWSTR
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $WcsDisassociateColorProfileFromDevice = Win32::API::More->new('mscms',
    'BOOL WcsDisassociateColorProfileFromDevice(int scope, LPCWSTR pProfileName, LPCWSTR pDeviceName)');
# my $ret = $WcsDisassociateColorProfileFromDevice->Call($scope, $pProfileName, $pDeviceName);
# scope : WCS_PROFILE_MANAGEMENT_SCOPE -> int
# pProfileName : LPCWSTR -> LPCWSTR
# pDeviceName : LPCWSTR -> LPCWSTR
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型