ホーム › UI.ColorSystem › SetColorProfileElementSize
SetColorProfileElementSize
関数プロファイル要素のサイズを設定する。
シグネチャ
// mscms.dll
#include <windows.h>
BOOL SetColorProfileElementSize(
INT_PTR hProfile,
DWORD tagType,
DWORD pcbElement
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| hProfile | INT_PTR | in | 要素サイズを設定する対象のカラープロファイルハンドル。 |
| tagType | DWORD | in | サイズを設定する対象要素のタグシグネチャ値。 |
| pcbElement | DWORD | in | 対象要素に割り当てる新しいバイトサイズ。 |
戻り値の型: BOOL
各言語での呼び出し定義
// mscms.dll
#include <windows.h>
BOOL SetColorProfileElementSize(
INT_PTR hProfile,
DWORD tagType,
DWORD pcbElement
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("mscms.dll", ExactSpelling = true)]
static extern bool SetColorProfileElementSize(
IntPtr hProfile, // INT_PTR
uint tagType, // DWORD
uint pcbElement // DWORD
);<DllImport("mscms.dll", ExactSpelling:=True)>
Public Shared Function SetColorProfileElementSize(
hProfile As IntPtr, ' INT_PTR
tagType As UInteger, ' DWORD
pcbElement As UInteger ' DWORD
) As <MarshalAs(UnmanagedType.Bool)> Boolean
End Function' hProfile : INT_PTR
' tagType : DWORD
' pcbElement : DWORD
Declare PtrSafe Function SetColorProfileElementSize Lib "mscms" ( _
ByVal hProfile As LongPtr, _
ByVal tagType As Long, _
ByVal pcbElement As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
SetColorProfileElementSize = ctypes.windll.mscms.SetColorProfileElementSize
SetColorProfileElementSize.restype = wintypes.BOOL
SetColorProfileElementSize.argtypes = [
ctypes.c_ssize_t, # hProfile : INT_PTR
wintypes.DWORD, # tagType : DWORD
wintypes.DWORD, # pcbElement : DWORD
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('mscms.dll')
SetColorProfileElementSize = Fiddle::Function.new(
lib['SetColorProfileElementSize'],
[
Fiddle::TYPE_INTPTR_T, # hProfile : INT_PTR
-Fiddle::TYPE_INT, # tagType : DWORD
-Fiddle::TYPE_INT, # pcbElement : DWORD
],
Fiddle::TYPE_INT)#[link(name = "mscms")]
extern "system" {
fn SetColorProfileElementSize(
hProfile: isize, // INT_PTR
tagType: u32, // DWORD
pcbElement: u32 // DWORD
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("mscms.dll")]
public static extern bool SetColorProfileElementSize(IntPtr hProfile, uint tagType, uint pcbElement);
"@
$api = Add-Type -MemberDefinition $sig -Name 'mscms_SetColorProfileElementSize' -Namespace Win32 -PassThru
# $api::SetColorProfileElementSize(hProfile, tagType, pcbElement)#uselib "mscms.dll"
#func global SetColorProfileElementSize "SetColorProfileElementSize" sptr, sptr, sptr
; SetColorProfileElementSize hProfile, tagType, pcbElement ; 戻り値は stat
; hProfile : INT_PTR -> "sptr"
; tagType : DWORD -> "sptr"
; pcbElement : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "mscms.dll"
#cfunc global SetColorProfileElementSize "SetColorProfileElementSize" sptr, int, int
; res = SetColorProfileElementSize(hProfile, tagType, pcbElement)
; hProfile : INT_PTR -> "sptr"
; tagType : DWORD -> "int"
; pcbElement : DWORD -> "int"; BOOL SetColorProfileElementSize(INT_PTR hProfile, DWORD tagType, DWORD pcbElement)
#uselib "mscms.dll"
#cfunc global SetColorProfileElementSize "SetColorProfileElementSize" intptr, int, int
; res = SetColorProfileElementSize(hProfile, tagType, pcbElement)
; hProfile : INT_PTR -> "intptr"
; tagType : DWORD -> "int"
; pcbElement : DWORD -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
mscms = windows.NewLazySystemDLL("mscms.dll")
procSetColorProfileElementSize = mscms.NewProc("SetColorProfileElementSize")
)
// hProfile (INT_PTR), tagType (DWORD), pcbElement (DWORD)
r1, _, err := procSetColorProfileElementSize.Call(
uintptr(hProfile),
uintptr(tagType),
uintptr(pcbElement),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction SetColorProfileElementSize(
hProfile: NativeInt; // INT_PTR
tagType: DWORD; // DWORD
pcbElement: DWORD // DWORD
): BOOL; stdcall;
external 'mscms.dll' name 'SetColorProfileElementSize';result := DllCall("mscms\SetColorProfileElementSize"
, "Ptr", hProfile ; INT_PTR
, "UInt", tagType ; DWORD
, "UInt", pcbElement ; DWORD
, "Int") ; return: BOOL●SetColorProfileElementSize(hProfile, tagType, pcbElement) = DLL("mscms.dll", "bool SetColorProfileElementSize(int, dword, dword)")
# 呼び出し: SetColorProfileElementSize(hProfile, tagType, pcbElement)
# hProfile : INT_PTR -> "int"
# tagType : DWORD -> "dword"
# pcbElement : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "mscms" fn SetColorProfileElementSize(
hProfile: isize, // INT_PTR
tagType: u32, // DWORD
pcbElement: u32 // DWORD
) callconv(std.os.windows.WINAPI) i32;proc SetColorProfileElementSize(
hProfile: int, # INT_PTR
tagType: uint32, # DWORD
pcbElement: uint32 # DWORD
): int32 {.importc: "SetColorProfileElementSize", stdcall, dynlib: "mscms.dll".}pragma(lib, "mscms");
extern(Windows)
int SetColorProfileElementSize(
ptrdiff_t hProfile, // INT_PTR
uint tagType, // DWORD
uint pcbElement // DWORD
);ccall((:SetColorProfileElementSize, "mscms.dll"), stdcall, Int32,
(Int, UInt32, UInt32),
hProfile, tagType, pcbElement)
# hProfile : INT_PTR -> Int
# tagType : DWORD -> UInt32
# pcbElement : DWORD -> UInt32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t SetColorProfileElementSize(
intptr_t hProfile,
uint32_t tagType,
uint32_t pcbElement);
]]
local mscms = ffi.load("mscms")
-- mscms.SetColorProfileElementSize(hProfile, tagType, pcbElement)
-- hProfile : INT_PTR
-- tagType : DWORD
-- pcbElement : DWORD
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('mscms.dll');
const SetColorProfileElementSize = lib.func('__stdcall', 'SetColorProfileElementSize', 'int32_t', ['intptr_t', 'uint32_t', 'uint32_t']);
// SetColorProfileElementSize(hProfile, tagType, pcbElement)
// hProfile : INT_PTR -> 'intptr_t'
// tagType : DWORD -> 'uint32_t'
// pcbElement : DWORD -> 'uint32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("mscms.dll", {
SetColorProfileElementSize: { parameters: ["isize", "u32", "u32"], result: "i32" },
});
// lib.symbols.SetColorProfileElementSize(hProfile, tagType, pcbElement)
// hProfile : INT_PTR -> "isize"
// tagType : DWORD -> "u32"
// pcbElement : DWORD -> "u32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t SetColorProfileElementSize(
intptr_t hProfile,
uint32_t tagType,
uint32_t pcbElement);
C, "mscms.dll");
// $ffi->SetColorProfileElementSize(hProfile, tagType, pcbElement);
// hProfile : INT_PTR
// tagType : DWORD
// pcbElement : DWORD
// 構造体/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 SetColorProfileElementSize(
long hProfile, // INT_PTR
int tagType, // DWORD
int pcbElement // DWORD
);
}@[Link("mscms")]
lib Libmscms
fun SetColorProfileElementSize = SetColorProfileElementSize(
hProfile : LibC::SSizeT, # INT_PTR
tagType : UInt32, # DWORD
pcbElement : UInt32 # DWORD
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef SetColorProfileElementSizeNative = Int32 Function(IntPtr, Uint32, Uint32);
typedef SetColorProfileElementSizeDart = int Function(int, int, int);
final SetColorProfileElementSize = DynamicLibrary.open('mscms.dll')
.lookupFunction<SetColorProfileElementSizeNative, SetColorProfileElementSizeDart>('SetColorProfileElementSize');
// hProfile : INT_PTR -> IntPtr
// tagType : DWORD -> Uint32
// pcbElement : DWORD -> Uint32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function SetColorProfileElementSize(
hProfile: NativeInt; // INT_PTR
tagType: DWORD; // DWORD
pcbElement: DWORD // DWORD
): BOOL; stdcall;
external 'mscms.dll' name 'SetColorProfileElementSize';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "SetColorProfileElementSize"
c_SetColorProfileElementSize :: CIntPtr -> Word32 -> Word32 -> IO CInt
-- hProfile : INT_PTR -> CIntPtr
-- tagType : DWORD -> Word32
-- pcbElement : DWORD -> Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let setcolorprofileelementsize =
foreign "SetColorProfileElementSize"
(intptr_t @-> uint32_t @-> uint32_t @-> returning int32_t)
(* hProfile : INT_PTR -> intptr_t *)
(* tagType : DWORD -> uint32_t *)
(* pcbElement : DWORD -> uint32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library mscms (t "mscms.dll"))
(cffi:use-foreign-library mscms)
(cffi:defcfun ("SetColorProfileElementSize" set-color-profile-element-size :convention :stdcall) :int32
(h-profile :int64) ; INT_PTR
(tag-type :uint32) ; DWORD
(pcb-element :uint32)) ; DWORD
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $SetColorProfileElementSize = Win32::API::More->new('mscms',
'BOOL SetColorProfileElementSize(LPARAM hProfile, DWORD tagType, DWORD pcbElement)');
# my $ret = $SetColorProfileElementSize->Call($hProfile, $tagType, $pcbElement);
# hProfile : INT_PTR -> LPARAM
# tagType : DWORD -> DWORD
# pcbElement : DWORD -> DWORD
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。