ホーム › Graphics.Gdi › CreateFontIndirectA
CreateFontIndirectA
関数LOGFONT構造体の指定に基づき論理フォントを作成する(ANSI版)。
シグネチャ
// GDI32.dll (ANSI / -A)
#include <windows.h>
HFONT CreateFontIndirectA(
const LOGFONTA* lplf
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| lplf | LOGFONTA* | in |
戻り値の型: HFONT
各言語での呼び出し定義
// GDI32.dll (ANSI / -A)
#include <windows.h>
HFONT CreateFontIndirectA(
const LOGFONTA* lplf
);[DllImport("GDI32.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern IntPtr CreateFontIndirectA(
IntPtr lplf // LOGFONTA*
);<DllImport("GDI32.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function CreateFontIndirectA(
lplf As IntPtr ' LOGFONTA*
) As IntPtr
End Function' lplf : LOGFONTA*
Declare PtrSafe Function CreateFontIndirectA Lib "gdi32" ( _
ByVal lplf As LongPtr) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
CreateFontIndirectA = ctypes.windll.gdi32.CreateFontIndirectA
CreateFontIndirectA.restype = ctypes.c_void_p
CreateFontIndirectA.argtypes = [
ctypes.c_void_p, # lplf : LOGFONTA*
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('GDI32.dll')
CreateFontIndirectA = Fiddle::Function.new(
lib['CreateFontIndirectA'],
[
Fiddle::TYPE_VOIDP, # lplf : LOGFONTA*
],
Fiddle::TYPE_VOIDP)#[link(name = "gdi32")]
extern "system" {
fn CreateFontIndirectA(
lplf: *const LOGFONTA // LOGFONTA*
) -> *mut core::ffi::c_void;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("GDI32.dll", CharSet = CharSet.Ansi)]
public static extern IntPtr CreateFontIndirectA(IntPtr lplf);
"@
$api = Add-Type -MemberDefinition $sig -Name 'GDI32_CreateFontIndirectA' -Namespace Win32 -PassThru
# $api::CreateFontIndirectA(lplf)#uselib "GDI32.dll"
#func global CreateFontIndirectA "CreateFontIndirectA" sptr
; CreateFontIndirectA varptr(lplf) ; 戻り値は stat
; lplf : LOGFONTA* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "GDI32.dll" #cfunc global CreateFontIndirectA "CreateFontIndirectA" var ; res = CreateFontIndirectA(lplf) ; lplf : LOGFONTA* -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "GDI32.dll" #cfunc global CreateFontIndirectA "CreateFontIndirectA" sptr ; res = CreateFontIndirectA(varptr(lplf)) ; lplf : LOGFONTA* -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HFONT CreateFontIndirectA(LOGFONTA* lplf) #uselib "GDI32.dll" #cfunc global CreateFontIndirectA "CreateFontIndirectA" var ; res = CreateFontIndirectA(lplf) ; lplf : LOGFONTA* -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HFONT CreateFontIndirectA(LOGFONTA* lplf) #uselib "GDI32.dll" #cfunc global CreateFontIndirectA "CreateFontIndirectA" intptr ; res = CreateFontIndirectA(varptr(lplf)) ; lplf : LOGFONTA* -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
gdi32 = windows.NewLazySystemDLL("GDI32.dll")
procCreateFontIndirectA = gdi32.NewProc("CreateFontIndirectA")
)
// lplf (LOGFONTA*)
r1, _, err := procCreateFontIndirectA.Call(
uintptr(lplf),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HFONTfunction CreateFontIndirectA(
lplf: Pointer // LOGFONTA*
): THandle; stdcall;
external 'GDI32.dll' name 'CreateFontIndirectA';result := DllCall("GDI32\CreateFontIndirectA"
, "Ptr", lplf ; LOGFONTA*
, "Ptr") ; return: HFONT●CreateFontIndirectA(lplf) = DLL("GDI32.dll", "void* CreateFontIndirectA(void*)")
# 呼び出し: CreateFontIndirectA(lplf)
# lplf : LOGFONTA* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。