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

GdipGetImageHeight

関数
イメージの高さをピクセル数で取得する。
DLLgdiplus.dll呼出規約winapi

シグネチャ

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

Status GdipGetImageHeight(
    GpImage* image,
    DWORD* height
);

パラメーター

名前方向
imageGpImage*inout
heightDWORD*inout

戻り値の型: Status

各言語での呼び出し定義

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

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

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

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

var (
	gdiplus = windows.NewLazySystemDLL("gdiplus.dll")
	procGdipGetImageHeight = gdiplus.NewProc("GdipGetImageHeight")
)

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