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

UninstallColorProfileA

関数
カラープロファイルをシステムから削除する(ANSI版)。
DLLmscms.dll文字セットANSI (-A)呼出規約winapi

シグネチャ

// mscms.dll  (ANSI / -A)
#include <windows.h>

BOOL UninstallColorProfileA(
    LPCSTR pMachineName,   // optional
    LPCSTR pProfileName,
    BOOL bDelete
);

パラメーター

名前方向説明
pMachineNameLPCSTRinoptional対象マシン名を指すANSI文字列ポインタ。ローカルではNULLを指定する。
pProfileNameLPCSTRinアンインストールするカラープロファイルのファイルパスを指すANSI文字列ポインタ。
bDeleteBOOLinTRUEならプロファイルファイル自体も削除するかを指定するフラグ。

戻り値の型: BOOL

各言語での呼び出し定義

// mscms.dll  (ANSI / -A)
#include <windows.h>

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

UninstallColorProfileA = ctypes.windll.mscms.UninstallColorProfileA
UninstallColorProfileA.restype = wintypes.BOOL
UninstallColorProfileA.argtypes = [
    wintypes.LPCSTR,  # pMachineName : LPCSTR optional
    wintypes.LPCSTR,  # pProfileName : LPCSTR
    wintypes.BOOL,  # bDelete : BOOL
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('mscms.dll')
UninstallColorProfileA = Fiddle::Function.new(
  lib['UninstallColorProfileA'],
  [
    Fiddle::TYPE_VOIDP,  # pMachineName : LPCSTR optional
    Fiddle::TYPE_VOIDP,  # pProfileName : LPCSTR
    Fiddle::TYPE_INT,  # bDelete : BOOL
  ],
  Fiddle::TYPE_INT)
#[link(name = "mscms")]
extern "system" {
    fn UninstallColorProfileA(
        pMachineName: *const u8,  // LPCSTR optional
        pProfileName: *const u8,  // LPCSTR
        bDelete: i32  // BOOL
    ) -> 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 UninstallColorProfileA([MarshalAs(UnmanagedType.LPStr)] string pMachineName, [MarshalAs(UnmanagedType.LPStr)] string pProfileName, bool bDelete);
"@
$api = Add-Type -MemberDefinition $sig -Name 'mscms_UninstallColorProfileA' -Namespace Win32 -PassThru
# $api::UninstallColorProfileA(pMachineName, pProfileName, bDelete)
#uselib "mscms.dll"
#func global UninstallColorProfileA "UninstallColorProfileA" sptr, sptr, sptr
; UninstallColorProfileA pMachineName, pProfileName, bDelete   ; 戻り値は stat
; pMachineName : LPCSTR optional -> "sptr"
; pProfileName : LPCSTR -> "sptr"
; bDelete : BOOL -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "mscms.dll"
#cfunc global UninstallColorProfileA "UninstallColorProfileA" str, str, int
; res = UninstallColorProfileA(pMachineName, pProfileName, bDelete)
; pMachineName : LPCSTR optional -> "str"
; pProfileName : LPCSTR -> "str"
; bDelete : BOOL -> "int"
; BOOL UninstallColorProfileA(LPCSTR pMachineName, LPCSTR pProfileName, BOOL bDelete)
#uselib "mscms.dll"
#cfunc global UninstallColorProfileA "UninstallColorProfileA" str, str, int
; res = UninstallColorProfileA(pMachineName, pProfileName, bDelete)
; pMachineName : LPCSTR optional -> "str"
; pProfileName : LPCSTR -> "str"
; bDelete : BOOL -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	mscms = windows.NewLazySystemDLL("mscms.dll")
	procUninstallColorProfileA = mscms.NewProc("UninstallColorProfileA")
)

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

extern "mscms" fn UninstallColorProfileA(
    pMachineName: [*c]const u8, // LPCSTR optional
    pProfileName: [*c]const u8, // LPCSTR
    bDelete: i32 // BOOL
) callconv(std.os.windows.WINAPI) i32;
proc UninstallColorProfileA(
    pMachineName: cstring,  # LPCSTR optional
    pProfileName: cstring,  # LPCSTR
    bDelete: int32  # BOOL
): int32 {.importc: "UninstallColorProfileA", stdcall, dynlib: "mscms.dll".}
pragma(lib, "mscms");
extern(Windows)
int UninstallColorProfileA(
    const(char)* pMachineName,   // LPCSTR optional
    const(char)* pProfileName,   // LPCSTR
    int bDelete   // BOOL
);
ccall((:UninstallColorProfileA, "mscms.dll"), stdcall, Int32,
      (Cstring, Cstring, Int32),
      pMachineName, pProfileName, bDelete)
# pMachineName : LPCSTR optional -> Cstring
# pProfileName : LPCSTR -> Cstring
# bDelete : BOOL -> Int32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t UninstallColorProfileA(
    const char* pMachineName,
    const char* pProfileName,
    int32_t bDelete);
]]
local mscms = ffi.load("mscms")
-- mscms.UninstallColorProfileA(pMachineName, pProfileName, bDelete)
-- pMachineName : LPCSTR optional
-- pProfileName : LPCSTR
-- bDelete : BOOL
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('mscms.dll');
const UninstallColorProfileA = lib.func('__stdcall', 'UninstallColorProfileA', 'int32_t', ['str', 'str', 'int32_t']);
// UninstallColorProfileA(pMachineName, pProfileName, bDelete)
// pMachineName : LPCSTR optional -> 'str'
// pProfileName : LPCSTR -> 'str'
// bDelete : BOOL -> 'int32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("mscms.dll", {
  UninstallColorProfileA: { parameters: ["buffer", "buffer", "i32"], result: "i32" },
});
// lib.symbols.UninstallColorProfileA(pMachineName, pProfileName, bDelete)
// pMachineName : LPCSTR optional -> "buffer"
// pProfileName : LPCSTR -> "buffer"
// bDelete : BOOL -> "i32"
// 文字列は "buffer"。ANSI(-A) は new TextEncoder() で UTF-8/ANSI バイト列(末尾に \x00)を渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t UninstallColorProfileA(
    const char* pMachineName,
    const char* pProfileName,
    int32_t bDelete);
C, "mscms.dll");
// $ffi->UninstallColorProfileA(pMachineName, pProfileName, bDelete);
// pMachineName : LPCSTR optional
// pProfileName : LPCSTR
// bDelete : 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, W32APIOptions.ASCII_OPTIONS);
    boolean UninstallColorProfileA(
        String pMachineName,   // LPCSTR optional
        String pProfileName,   // LPCSTR
        boolean bDelete   // BOOL
    );
}
@[Link("mscms")]
lib Libmscms
  fun UninstallColorProfileA = UninstallColorProfileA(
    pMachineName : UInt8*,   # LPCSTR optional
    pProfileName : UInt8*,   # LPCSTR
    bDelete : 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 UninstallColorProfileANative = Int32 Function(Pointer<Utf8>, Pointer<Utf8>, Int32);
typedef UninstallColorProfileADart = int Function(Pointer<Utf8>, Pointer<Utf8>, int);
final UninstallColorProfileA = DynamicLibrary.open('mscms.dll')
    .lookupFunction<UninstallColorProfileANative, UninstallColorProfileADart>('UninstallColorProfileA');
// pMachineName : LPCSTR optional -> Pointer<Utf8>
// pProfileName : LPCSTR -> Pointer<Utf8>
// bDelete : BOOL -> Int32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function UninstallColorProfileA(
  pMachineName: PAnsiChar;   // LPCSTR optional
  pProfileName: PAnsiChar;   // LPCSTR
  bDelete: BOOL   // BOOL
): BOOL; stdcall;
  external 'mscms.dll' name 'UninstallColorProfileA';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "UninstallColorProfileA"
  c_UninstallColorProfileA :: CString -> CString -> CInt -> IO CInt
-- pMachineName : LPCSTR optional -> CString
-- pProfileName : LPCSTR -> CString
-- bDelete : BOOL -> CInt
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let uninstallcolorprofilea =
  foreign "UninstallColorProfileA"
    (string @-> string @-> int32_t @-> returning int32_t)
(* pMachineName : LPCSTR optional -> string *)
(* pProfileName : LPCSTR -> string *)
(* bDelete : 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 ("UninstallColorProfileA" uninstall-color-profile-a :convention :stdcall) :int32
  (p-machine-name :string)   ; LPCSTR optional
  (p-profile-name :string)   ; LPCSTR
  (b-delete :int32))   ; BOOL
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $UninstallColorProfileA = Win32::API::More->new('mscms',
    'BOOL UninstallColorProfileA(LPCSTR pMachineName, LPCSTR pProfileName, BOOL bDelete)');
# my $ret = $UninstallColorProfileA->Call($pMachineName, $pProfileName, $bDelete);
# pMachineName : LPCSTR optional -> LPCSTR
# pProfileName : LPCSTR -> LPCSTR
# bDelete : BOOL -> BOOL
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

文字セット違い