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

SetColorProfileElementSize

関数
プロファイル要素のサイズを設定する。
DLLmscms.dll呼出規約winapi

シグネチャ

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

BOOL SetColorProfileElementSize(
    INT_PTR hProfile,
    DWORD tagType,
    DWORD pcbElement
);

パラメーター

名前方向
hProfileINT_PTRin
tagTypeDWORDin
pcbElementDWORDin

戻り値の型: 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 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   // BOOL
function 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)。