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

GdipIsStyleAvailable

関数
指定スタイルがフォントファミリーで利用可能か判定する。
DLLgdiplus.dll呼出規約winapi

シグネチャ

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

Status GdipIsStyleAvailable(
    const GpFontFamily* family,
    INT style,
    BOOL* IsStyleAvailable
);

パラメーター

名前方向
familyGpFontFamily*in
styleINTin
IsStyleAvailableBOOL*inout

戻り値の型: Status

各言語での呼び出し定義

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

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

GdipIsStyleAvailable = ctypes.windll.gdiplus.GdipIsStyleAvailable
GdipIsStyleAvailable.restype = ctypes.c_int
GdipIsStyleAvailable.argtypes = [
    ctypes.c_void_p,  # family : GpFontFamily*
    ctypes.c_int,  # style : INT
    ctypes.c_void_p,  # IsStyleAvailable : BOOL* in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	gdiplus = windows.NewLazySystemDLL("gdiplus.dll")
	procGdipIsStyleAvailable = gdiplus.NewProc("GdipIsStyleAvailable")
)

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