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

UninstallColorProfileW

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

シグネチャ

// mscms.dll  (Unicode / -W)
#include <windows.h>

BOOL UninstallColorProfileW(
    LPCWSTR pMachineName,   // optional
    LPCWSTR pProfileName,
    BOOL bDelete
);

パラメーター

名前方向
pMachineNameLPCWSTRinoptional
pProfileNameLPCWSTRin
bDeleteBOOLin

戻り値の型: BOOL

各言語での呼び出し定義

// mscms.dll  (Unicode / -W)
#include <windows.h>

BOOL UninstallColorProfileW(
    LPCWSTR pMachineName,   // optional
    LPCWSTR pProfileName,
    BOOL bDelete
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("mscms.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern bool UninstallColorProfileW(
    [MarshalAs(UnmanagedType.LPWStr)] string pMachineName,   // LPCWSTR optional
    [MarshalAs(UnmanagedType.LPWStr)] string pProfileName,   // LPCWSTR
    bool bDelete   // BOOL
);
<DllImport("mscms.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function UninstallColorProfileW(
    <MarshalAs(UnmanagedType.LPWStr)> pMachineName As String,   ' LPCWSTR optional
    <MarshalAs(UnmanagedType.LPWStr)> pProfileName As String,   ' LPCWSTR
    bDelete As Boolean   ' BOOL
) As Boolean
End Function
' pMachineName : LPCWSTR optional
' pProfileName : LPCWSTR
' bDelete : BOOL
Declare PtrSafe Function UninstallColorProfileW Lib "mscms" ( _
    ByVal pMachineName As LongPtr, _
    ByVal pProfileName As LongPtr, _
    ByVal bDelete As Long) As Long
' Unicode(W): 文字列は ByVal As LongPtr とし StrPtr(unicodeStr) を渡す
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

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

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

var (
	mscms = windows.NewLazySystemDLL("mscms.dll")
	procUninstallColorProfileW = mscms.NewProc("UninstallColorProfileW")
)

// pMachineName (LPCWSTR optional), pProfileName (LPCWSTR), bDelete (BOOL)
r1, _, err := procUninstallColorProfileW.Call(
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pMachineName))),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pProfileName))),
	uintptr(bDelete),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function UninstallColorProfileW(
  pMachineName: PWideChar;   // LPCWSTR optional
  pProfileName: PWideChar;   // LPCWSTR
  bDelete: BOOL   // BOOL
): BOOL; stdcall;
  external 'mscms.dll' name 'UninstallColorProfileW';
result := DllCall("mscms\UninstallColorProfileW"
    , "WStr", pMachineName   ; LPCWSTR optional
    , "WStr", pProfileName   ; LPCWSTR
    , "Int", bDelete   ; BOOL
    , "Int")   ; return: BOOL
●UninstallColorProfileW(pMachineName, pProfileName, bDelete) = DLL("mscms.dll", "bool UninstallColorProfileW(char*, char*, bool)")
# 呼び出し: UninstallColorProfileW(pMachineName, pProfileName, bDelete)
# pMachineName : LPCWSTR optional -> "char*"
# pProfileName : LPCWSTR -> "char*"
# bDelete : BOOL -> "bool"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。