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

GdipGetCellAscent

関数
フォントファミリーのセルアセント値を取得する。
DLLgdiplus.dll呼出規約winapi

シグネチャ

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

Status GdipGetCellAscent(
    const GpFontFamily* family,
    INT style,
    WORD* CellAscent
);

パラメーター

名前方向
familyGpFontFamily*in
styleINTin
CellAscentWORD*inout

戻り値の型: Status

各言語での呼び出し定義

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

Status GdipGetCellAscent(
    const GpFontFamily* family,
    INT style,
    WORD* CellAscent
);
[DllImport("gdiplus.dll", ExactSpelling = true)]
static extern int GdipGetCellAscent(
    IntPtr family,   // GpFontFamily*
    int style,   // INT
    ref ushort CellAscent   // WORD* in/out
);
<DllImport("gdiplus.dll", ExactSpelling:=True)>
Public Shared Function GdipGetCellAscent(
    family As IntPtr,   ' GpFontFamily*
    style As Integer,   ' INT
    ByRef CellAscent As UShort   ' WORD* in/out
) As Integer
End Function
' family : GpFontFamily*
' style : INT
' CellAscent : WORD* in/out
Declare PtrSafe Function GdipGetCellAscent Lib "gdiplus" ( _
    ByVal family As LongPtr, _
    ByVal style As Long, _
    ByRef CellAscent As Integer) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

GdipGetCellAscent = ctypes.windll.gdiplus.GdipGetCellAscent
GdipGetCellAscent.restype = ctypes.c_int
GdipGetCellAscent.argtypes = [
    ctypes.c_void_p,  # family : GpFontFamily*
    ctypes.c_int,  # style : INT
    ctypes.POINTER(ctypes.c_ushort),  # CellAscent : WORD* in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	gdiplus = windows.NewLazySystemDLL("gdiplus.dll")
	procGdipGetCellAscent = gdiplus.NewProc("GdipGetCellAscent")
)

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