Win32 API 日本語リファレンス
ホームGraphics.GdiPlus › GdipGetPropertyItemSize

GdipGetPropertyItemSize

関数
指定したプロパティ項目のバイトサイズを取得する。
DLLgdiplus.dll呼出規約winapi

シグネチャ

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

Status GdipGetPropertyItemSize(
    GpImage* image,
    DWORD propId,
    DWORD* size
);

パラメーター

名前方向
imageGpImage*inout
propIdDWORDin
sizeDWORD*inout

戻り値の型: Status

各言語での呼び出し定義

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

Status GdipGetPropertyItemSize(
    GpImage* image,
    DWORD propId,
    DWORD* size
);
[DllImport("gdiplus.dll", ExactSpelling = true)]
static extern int GdipGetPropertyItemSize(
    IntPtr image,   // GpImage* in/out
    uint propId,   // DWORD
    ref uint size   // DWORD* in/out
);
<DllImport("gdiplus.dll", ExactSpelling:=True)>
Public Shared Function GdipGetPropertyItemSize(
    image As IntPtr,   ' GpImage* in/out
    propId As UInteger,   ' DWORD
    ByRef size As UInteger   ' DWORD* in/out
) As Integer
End Function
' image : GpImage* in/out
' propId : DWORD
' size : DWORD* in/out
Declare PtrSafe Function GdipGetPropertyItemSize Lib "gdiplus" ( _
    ByVal image As LongPtr, _
    ByVal propId As Long, _
    ByRef size As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

GdipGetPropertyItemSize = ctypes.windll.gdiplus.GdipGetPropertyItemSize
GdipGetPropertyItemSize.restype = ctypes.c_int
GdipGetPropertyItemSize.argtypes = [
    ctypes.c_void_p,  # image : GpImage* in/out
    wintypes.DWORD,  # propId : DWORD
    ctypes.POINTER(wintypes.DWORD),  # size : DWORD* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('gdiplus.dll')
GdipGetPropertyItemSize = Fiddle::Function.new(
  lib['GdipGetPropertyItemSize'],
  [
    Fiddle::TYPE_VOIDP,  # image : GpImage* in/out
    -Fiddle::TYPE_INT,  # propId : DWORD
    Fiddle::TYPE_VOIDP,  # size : DWORD* in/out
  ],
  Fiddle::TYPE_INT)
#[link(name = "gdiplus")]
extern "system" {
    fn GdipGetPropertyItemSize(
        image: *mut GpImage,  // GpImage* in/out
        propId: u32,  // DWORD
        size: *mut u32  // DWORD* in/out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("gdiplus.dll")]
public static extern int GdipGetPropertyItemSize(IntPtr image, uint propId, ref uint size);
"@
$api = Add-Type -MemberDefinition $sig -Name 'gdiplus_GdipGetPropertyItemSize' -Namespace Win32 -PassThru
# $api::GdipGetPropertyItemSize(image, propId, size)
#uselib "gdiplus.dll"
#func global GdipGetPropertyItemSize "GdipGetPropertyItemSize" sptr, sptr, sptr
; GdipGetPropertyItemSize varptr(image), propId, varptr(size)   ; 戻り値は stat
; image : GpImage* in/out -> "sptr"
; propId : DWORD -> "sptr"
; size : DWORD* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "gdiplus.dll"
#cfunc global GdipGetPropertyItemSize "GdipGetPropertyItemSize" var, int, var
; res = GdipGetPropertyItemSize(image, propId, size)
; image : GpImage* in/out -> "var"
; propId : DWORD -> "int"
; size : DWORD* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; Status GdipGetPropertyItemSize(GpImage* image, DWORD propId, DWORD* size)
#uselib "gdiplus.dll"
#cfunc global GdipGetPropertyItemSize "GdipGetPropertyItemSize" var, int, var
; res = GdipGetPropertyItemSize(image, propId, size)
; image : GpImage* in/out -> "var"
; propId : DWORD -> "int"
; size : DWORD* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	gdiplus = windows.NewLazySystemDLL("gdiplus.dll")
	procGdipGetPropertyItemSize = gdiplus.NewProc("GdipGetPropertyItemSize")
)

// image (GpImage* in/out), propId (DWORD), size (DWORD* in/out)
r1, _, err := procGdipGetPropertyItemSize.Call(
	uintptr(image),
	uintptr(propId),
	uintptr(size),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // Status
function GdipGetPropertyItemSize(
  image: Pointer;   // GpImage* in/out
  propId: DWORD;   // DWORD
  size: Pointer   // DWORD* in/out
): Integer; stdcall;
  external 'gdiplus.dll' name 'GdipGetPropertyItemSize';
result := DllCall("gdiplus\GdipGetPropertyItemSize"
    , "Ptr", image   ; GpImage* in/out
    , "UInt", propId   ; DWORD
    , "Ptr", size   ; DWORD* in/out
    , "Int")   ; return: Status
●GdipGetPropertyItemSize(image, propId, size) = DLL("gdiplus.dll", "int GdipGetPropertyItemSize(void*, dword, void*)")
# 呼び出し: GdipGetPropertyItemSize(image, propId, size)
# image : GpImage* in/out -> "void*"
# propId : DWORD -> "dword"
# size : DWORD* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。