ホーム › Graphics.Gdi › AddFontResourceA
AddFontResourceA
関数指定したフォントファイルをシステムに追加する(ANSI版)。
シグネチャ
// GDI32.dll (ANSI / -A)
#include <windows.h>
INT AddFontResourceA(
LPCSTR param0
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| param0 | LPCSTR | in |
戻り値の型: INT
各言語での呼び出し定義
// GDI32.dll (ANSI / -A)
#include <windows.h>
INT AddFontResourceA(
LPCSTR param0
);[DllImport("GDI32.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern int AddFontResourceA(
[MarshalAs(UnmanagedType.LPStr)] string param0 // LPCSTR
);<DllImport("GDI32.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function AddFontResourceA(
<MarshalAs(UnmanagedType.LPStr)> param0 As String ' LPCSTR
) As Integer
End Function' param0 : LPCSTR
Declare PtrSafe Function AddFontResourceA Lib "gdi32" ( _
ByVal param0 As String) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
AddFontResourceA = ctypes.windll.gdi32.AddFontResourceA
AddFontResourceA.restype = ctypes.c_int
AddFontResourceA.argtypes = [
wintypes.LPCSTR, # param0 : LPCSTR
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('GDI32.dll')
AddFontResourceA = Fiddle::Function.new(
lib['AddFontResourceA'],
[
Fiddle::TYPE_VOIDP, # param0 : LPCSTR
],
Fiddle::TYPE_INT)#[link(name = "gdi32")]
extern "system" {
fn AddFontResourceA(
param0: *const u8 // LPCSTR
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("GDI32.dll", CharSet = CharSet.Ansi)]
public static extern int AddFontResourceA([MarshalAs(UnmanagedType.LPStr)] string param0);
"@
$api = Add-Type -MemberDefinition $sig -Name 'GDI32_AddFontResourceA' -Namespace Win32 -PassThru
# $api::AddFontResourceA(param0)#uselib "GDI32.dll"
#func global AddFontResourceA "AddFontResourceA" sptr
; AddFontResourceA param0 ; 戻り値は stat
; param0 : LPCSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "GDI32.dll"
#cfunc global AddFontResourceA "AddFontResourceA" str
; res = AddFontResourceA(param0)
; param0 : LPCSTR -> "str"; INT AddFontResourceA(LPCSTR param0)
#uselib "GDI32.dll"
#cfunc global AddFontResourceA "AddFontResourceA" str
; res = AddFontResourceA(param0)
; param0 : LPCSTR -> "str"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
gdi32 = windows.NewLazySystemDLL("GDI32.dll")
procAddFontResourceA = gdi32.NewProc("AddFontResourceA")
)
// param0 (LPCSTR)
r1, _, err := procAddFontResourceA.Call(
uintptr(unsafe.Pointer(windows.BytePtrFromString(param0))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction AddFontResourceA(
param0: PAnsiChar // LPCSTR
): Integer; stdcall;
external 'GDI32.dll' name 'AddFontResourceA';result := DllCall("GDI32\AddFontResourceA"
, "AStr", param0 ; LPCSTR
, "Int") ; return: INT●AddFontResourceA(param0) = DLL("GDI32.dll", "int AddFontResourceA(char*)")
# 呼び出し: AddFontResourceA(param0)
# param0 : LPCSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。