ホーム › UI.ColorSystem › DisassociateColorProfileFromDeviceA
DisassociateColorProfileFromDeviceA
関数カラープロファイルとデバイスの関連付けを解除する(ANSI版)。
シグネチャ
// mscms.dll (ANSI / -A)
#include <windows.h>
BOOL DisassociateColorProfileFromDeviceA(
LPCSTR pMachineName, // optional
LPCSTR pProfileName,
LPCSTR pDeviceName
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| pMachineName | LPCSTR | inoptional | 対象マシン名を指すANSI文字列ポインタ。ローカルではNULLを指定する。 |
| pProfileName | LPCSTR | in | デバイスから関連付けを解除するカラープロファイル名を指すANSI文字列ポインタ。 |
| pDeviceName | LPCSTR | in | 関連付けを解除する対象デバイス名を指すANSI文字列ポインタ。 |
戻り値の型: BOOL
各言語での呼び出し定義
// mscms.dll (ANSI / -A)
#include <windows.h>
BOOL DisassociateColorProfileFromDeviceA(
LPCSTR pMachineName, // optional
LPCSTR pProfileName,
LPCSTR pDeviceName
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("mscms.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern bool DisassociateColorProfileFromDeviceA(
[MarshalAs(UnmanagedType.LPStr)] string pMachineName, // LPCSTR optional
[MarshalAs(UnmanagedType.LPStr)] string pProfileName, // LPCSTR
[MarshalAs(UnmanagedType.LPStr)] string pDeviceName // LPCSTR
);<DllImport("mscms.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function DisassociateColorProfileFromDeviceA(
<MarshalAs(UnmanagedType.LPStr)> pMachineName As String, ' LPCSTR optional
<MarshalAs(UnmanagedType.LPStr)> pProfileName As String, ' LPCSTR
<MarshalAs(UnmanagedType.LPStr)> pDeviceName As String ' LPCSTR
) As <MarshalAs(UnmanagedType.Bool)> Boolean
End Function' pMachineName : LPCSTR optional
' pProfileName : LPCSTR
' pDeviceName : LPCSTR
Declare PtrSafe Function DisassociateColorProfileFromDeviceA Lib "mscms" ( _
ByVal pMachineName As String, _
ByVal pProfileName As String, _
ByVal pDeviceName As String) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
DisassociateColorProfileFromDeviceA = ctypes.windll.mscms.DisassociateColorProfileFromDeviceA
DisassociateColorProfileFromDeviceA.restype = wintypes.BOOL
DisassociateColorProfileFromDeviceA.argtypes = [
wintypes.LPCSTR, # pMachineName : LPCSTR optional
wintypes.LPCSTR, # pProfileName : LPCSTR
wintypes.LPCSTR, # pDeviceName : LPCSTR
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('mscms.dll')
DisassociateColorProfileFromDeviceA = Fiddle::Function.new(
lib['DisassociateColorProfileFromDeviceA'],
[
Fiddle::TYPE_VOIDP, # pMachineName : LPCSTR optional
Fiddle::TYPE_VOIDP, # pProfileName : LPCSTR
Fiddle::TYPE_VOIDP, # pDeviceName : LPCSTR
],
Fiddle::TYPE_INT)#[link(name = "mscms")]
extern "system" {
fn DisassociateColorProfileFromDeviceA(
pMachineName: *const u8, // LPCSTR optional
pProfileName: *const u8, // LPCSTR
pDeviceName: *const u8 // LPCSTR
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("mscms.dll", CharSet = CharSet.Ansi)]
public static extern bool DisassociateColorProfileFromDeviceA([MarshalAs(UnmanagedType.LPStr)] string pMachineName, [MarshalAs(UnmanagedType.LPStr)] string pProfileName, [MarshalAs(UnmanagedType.LPStr)] string pDeviceName);
"@
$api = Add-Type -MemberDefinition $sig -Name 'mscms_DisassociateColorProfileFromDeviceA' -Namespace Win32 -PassThru
# $api::DisassociateColorProfileFromDeviceA(pMachineName, pProfileName, pDeviceName)#uselib "mscms.dll"
#func global DisassociateColorProfileFromDeviceA "DisassociateColorProfileFromDeviceA" sptr, sptr, sptr
; DisassociateColorProfileFromDeviceA pMachineName, pProfileName, pDeviceName ; 戻り値は stat
; pMachineName : LPCSTR optional -> "sptr"
; pProfileName : LPCSTR -> "sptr"
; pDeviceName : LPCSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "mscms.dll"
#cfunc global DisassociateColorProfileFromDeviceA "DisassociateColorProfileFromDeviceA" str, str, str
; res = DisassociateColorProfileFromDeviceA(pMachineName, pProfileName, pDeviceName)
; pMachineName : LPCSTR optional -> "str"
; pProfileName : LPCSTR -> "str"
; pDeviceName : LPCSTR -> "str"; BOOL DisassociateColorProfileFromDeviceA(LPCSTR pMachineName, LPCSTR pProfileName, LPCSTR pDeviceName)
#uselib "mscms.dll"
#cfunc global DisassociateColorProfileFromDeviceA "DisassociateColorProfileFromDeviceA" str, str, str
; res = DisassociateColorProfileFromDeviceA(pMachineName, pProfileName, pDeviceName)
; pMachineName : LPCSTR optional -> "str"
; pProfileName : LPCSTR -> "str"
; pDeviceName : LPCSTR -> "str"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
mscms = windows.NewLazySystemDLL("mscms.dll")
procDisassociateColorProfileFromDeviceA = mscms.NewProc("DisassociateColorProfileFromDeviceA")
)
// pMachineName (LPCSTR optional), pProfileName (LPCSTR), pDeviceName (LPCSTR)
r1, _, err := procDisassociateColorProfileFromDeviceA.Call(
uintptr(unsafe.Pointer(windows.BytePtrFromString(pMachineName))),
uintptr(unsafe.Pointer(windows.BytePtrFromString(pProfileName))),
uintptr(unsafe.Pointer(windows.BytePtrFromString(pDeviceName))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction DisassociateColorProfileFromDeviceA(
pMachineName: PAnsiChar; // LPCSTR optional
pProfileName: PAnsiChar; // LPCSTR
pDeviceName: PAnsiChar // LPCSTR
): BOOL; stdcall;
external 'mscms.dll' name 'DisassociateColorProfileFromDeviceA';result := DllCall("mscms\DisassociateColorProfileFromDeviceA"
, "AStr", pMachineName ; LPCSTR optional
, "AStr", pProfileName ; LPCSTR
, "AStr", pDeviceName ; LPCSTR
, "Int") ; return: BOOL●DisassociateColorProfileFromDeviceA(pMachineName, pProfileName, pDeviceName) = DLL("mscms.dll", "bool DisassociateColorProfileFromDeviceA(char*, char*, char*)")
# 呼び出し: DisassociateColorProfileFromDeviceA(pMachineName, pProfileName, pDeviceName)
# pMachineName : LPCSTR optional -> "char*"
# pProfileName : LPCSTR -> "char*"
# pDeviceName : LPCSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "mscms" fn DisassociateColorProfileFromDeviceA(
pMachineName: [*c]const u8, // LPCSTR optional
pProfileName: [*c]const u8, // LPCSTR
pDeviceName: [*c]const u8 // LPCSTR
) callconv(std.os.windows.WINAPI) i32;proc DisassociateColorProfileFromDeviceA(
pMachineName: cstring, # LPCSTR optional
pProfileName: cstring, # LPCSTR
pDeviceName: cstring # LPCSTR
): int32 {.importc: "DisassociateColorProfileFromDeviceA", stdcall, dynlib: "mscms.dll".}pragma(lib, "mscms");
extern(Windows)
int DisassociateColorProfileFromDeviceA(
const(char)* pMachineName, // LPCSTR optional
const(char)* pProfileName, // LPCSTR
const(char)* pDeviceName // LPCSTR
);ccall((:DisassociateColorProfileFromDeviceA, "mscms.dll"), stdcall, Int32,
(Cstring, Cstring, Cstring),
pMachineName, pProfileName, pDeviceName)
# pMachineName : LPCSTR optional -> Cstring
# pProfileName : LPCSTR -> Cstring
# pDeviceName : LPCSTR -> Cstring
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t DisassociateColorProfileFromDeviceA(
const char* pMachineName,
const char* pProfileName,
const char* pDeviceName);
]]
local mscms = ffi.load("mscms")
-- mscms.DisassociateColorProfileFromDeviceA(pMachineName, pProfileName, pDeviceName)
-- pMachineName : LPCSTR optional
-- pProfileName : LPCSTR
-- pDeviceName : LPCSTR
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('mscms.dll');
const DisassociateColorProfileFromDeviceA = lib.func('__stdcall', 'DisassociateColorProfileFromDeviceA', 'int32_t', ['str', 'str', 'str']);
// DisassociateColorProfileFromDeviceA(pMachineName, pProfileName, pDeviceName)
// pMachineName : LPCSTR optional -> 'str'
// pProfileName : LPCSTR -> 'str'
// pDeviceName : LPCSTR -> 'str'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("mscms.dll", {
DisassociateColorProfileFromDeviceA: { parameters: ["buffer", "buffer", "buffer"], result: "i32" },
});
// lib.symbols.DisassociateColorProfileFromDeviceA(pMachineName, pProfileName, pDeviceName)
// pMachineName : LPCSTR optional -> "buffer"
// pProfileName : LPCSTR -> "buffer"
// pDeviceName : LPCSTR -> "buffer"
// 文字列は "buffer"。ANSI(-A) は new TextEncoder() で UTF-8/ANSI バイト列(末尾に \x00)を渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t DisassociateColorProfileFromDeviceA(
const char* pMachineName,
const char* pProfileName,
const char* pDeviceName);
C, "mscms.dll");
// $ffi->DisassociateColorProfileFromDeviceA(pMachineName, pProfileName, pDeviceName);
// pMachineName : LPCSTR optional
// pProfileName : LPCSTR
// pDeviceName : LPCSTR
// 構造体/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, W32APIOptions.ASCII_OPTIONS);
boolean DisassociateColorProfileFromDeviceA(
String pMachineName, // LPCSTR optional
String pProfileName, // LPCSTR
String pDeviceName // LPCSTR
);
}@[Link("mscms")]
lib Libmscms
fun DisassociateColorProfileFromDeviceA = DisassociateColorProfileFromDeviceA(
pMachineName : UInt8*, # LPCSTR optional
pProfileName : UInt8*, # LPCSTR
pDeviceName : UInt8* # LPCSTR
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef DisassociateColorProfileFromDeviceANative = Int32 Function(Pointer<Utf8>, Pointer<Utf8>, Pointer<Utf8>);
typedef DisassociateColorProfileFromDeviceADart = int Function(Pointer<Utf8>, Pointer<Utf8>, Pointer<Utf8>);
final DisassociateColorProfileFromDeviceA = DynamicLibrary.open('mscms.dll')
.lookupFunction<DisassociateColorProfileFromDeviceANative, DisassociateColorProfileFromDeviceADart>('DisassociateColorProfileFromDeviceA');
// pMachineName : LPCSTR optional -> Pointer<Utf8>
// pProfileName : LPCSTR -> Pointer<Utf8>
// pDeviceName : LPCSTR -> Pointer<Utf8>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function DisassociateColorProfileFromDeviceA(
pMachineName: PAnsiChar; // LPCSTR optional
pProfileName: PAnsiChar; // LPCSTR
pDeviceName: PAnsiChar // LPCSTR
): BOOL; stdcall;
external 'mscms.dll' name 'DisassociateColorProfileFromDeviceA';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "DisassociateColorProfileFromDeviceA"
c_DisassociateColorProfileFromDeviceA :: CString -> CString -> CString -> IO CInt
-- pMachineName : LPCSTR optional -> CString
-- pProfileName : LPCSTR -> CString
-- pDeviceName : LPCSTR -> CString
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let disassociatecolorprofilefromdevicea =
foreign "DisassociateColorProfileFromDeviceA"
(string @-> string @-> string @-> returning int32_t)
(* pMachineName : LPCSTR optional -> string *)
(* pProfileName : LPCSTR -> string *)
(* pDeviceName : LPCSTR -> string *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library mscms (t "mscms.dll"))
(cffi:use-foreign-library mscms)
(cffi:defcfun ("DisassociateColorProfileFromDeviceA" disassociate-color-profile-from-device-a :convention :stdcall) :int32
(p-machine-name :string) ; LPCSTR optional
(p-profile-name :string) ; LPCSTR
(p-device-name :string)) ; LPCSTR
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $DisassociateColorProfileFromDeviceA = Win32::API::More->new('mscms',
'BOOL DisassociateColorProfileFromDeviceA(LPCSTR pMachineName, LPCSTR pProfileName, LPCSTR pDeviceName)');
# my $ret = $DisassociateColorProfileFromDeviceA->Call($pMachineName, $pProfileName, $pDeviceName);
# pMachineName : LPCSTR optional -> LPCSTR
# pProfileName : LPCSTR -> LPCSTR
# pDeviceName : LPCSTR -> LPCSTR
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
文字セット違い
- f DisassociateColorProfileFromDeviceW (Unicode版) — カラープロファイルとデバイスの関連付けを解除する(Unicode版)。