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

CloseColorProfile

関数
開いているカラープロファイルを閉じる。
DLLmscms.dll呼出規約winapi

シグネチャ

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

BOOL CloseColorProfile(
    INT_PTR hProfile   // optional
);

パラメーター

名前方向説明
hProfileINT_PTRinoptionalOpenColorProfileで取得した、閉じる対象のカラープロファイルハンドル。

戻り値の型: BOOL

各言語での呼び出し定義

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

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

CloseColorProfile = ctypes.windll.mscms.CloseColorProfile
CloseColorProfile.restype = wintypes.BOOL
CloseColorProfile.argtypes = [
    ctypes.c_ssize_t,  # hProfile : INT_PTR optional
]
require 'fiddle'
require 'fiddle/import'

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

var (
	mscms = windows.NewLazySystemDLL("mscms.dll")
	procCloseColorProfile = mscms.NewProc("CloseColorProfile")
)

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

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

typedef CloseColorProfileNative = Int32 Function(IntPtr);
typedef CloseColorProfileDart = int Function(int);
final CloseColorProfile = DynamicLibrary.open('mscms.dll')
    .lookupFunction<CloseColorProfileNative, CloseColorProfileDart>('CloseColorProfile');
// hProfile : INT_PTR optional -> IntPtr
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function CloseColorProfile(
  hProfile: NativeInt   // INT_PTR optional
): BOOL; stdcall;
  external 'mscms.dll' name 'CloseColorProfile';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "CloseColorProfile"
  c_CloseColorProfile :: CIntPtr -> IO CInt
-- hProfile : INT_PTR optional -> CIntPtr
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let closecolorprofile =
  foreign "CloseColorProfile"
    (intptr_t @-> returning int32_t)
(* hProfile : INT_PTR optional -> intptr_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library mscms (t "mscms.dll"))
(cffi:use-foreign-library mscms)

(cffi:defcfun ("CloseColorProfile" close-color-profile :convention :stdcall) :int32
  (h-profile :int64))   ; INT_PTR optional
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $CloseColorProfile = Win32::API::More->new('mscms',
    'BOOL CloseColorProfile(LPARAM hProfile)');
# my $ret = $CloseColorProfile->Call($hProfile);
# hProfile : INT_PTR optional -> LPARAM
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。