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

RemoveFontResourceExA

関数
追加したフォントリソースをシステムから削除する。
DLLGDI32.dll文字セットANSI (-A)呼出規約winapi対応OSWindows 2000 以降

シグネチャ

// GDI32.dll  (ANSI / -A)
#include <windows.h>

BOOL RemoveFontResourceExA(
    LPCSTR name,
    DWORD fl,
    void* pdv   // optional
);

パラメーター

名前方向
nameLPCSTRin
flDWORDin
pdvvoid*optional

戻り値の型: BOOL

各言語での呼び出し定義

// GDI32.dll  (ANSI / -A)
#include <windows.h>

BOOL RemoveFontResourceExA(
    LPCSTR name,
    DWORD fl,
    void* pdv   // optional
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("GDI32.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern bool RemoveFontResourceExA(
    [MarshalAs(UnmanagedType.LPStr)] string name,   // LPCSTR
    uint fl,   // DWORD
    IntPtr pdv   // void* optional
);
<DllImport("GDI32.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function RemoveFontResourceExA(
    <MarshalAs(UnmanagedType.LPStr)> name As String,   ' LPCSTR
    fl As UInteger,   ' DWORD
    pdv As IntPtr   ' void* optional
) As Boolean
End Function
' name : LPCSTR
' fl : DWORD
' pdv : void* optional
Declare PtrSafe Function RemoveFontResourceExA Lib "gdi32" ( _
    ByVal name As String, _
    ByVal fl As Long, _
    ByVal pdv As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

RemoveFontResourceExA = ctypes.windll.gdi32.RemoveFontResourceExA
RemoveFontResourceExA.restype = wintypes.BOOL
RemoveFontResourceExA.argtypes = [
    wintypes.LPCSTR,  # name : LPCSTR
    wintypes.DWORD,  # fl : DWORD
    ctypes.POINTER(None),  # pdv : void* optional
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('GDI32.dll')
RemoveFontResourceExA = Fiddle::Function.new(
  lib['RemoveFontResourceExA'],
  [
    Fiddle::TYPE_VOIDP,  # name : LPCSTR
    -Fiddle::TYPE_INT,  # fl : DWORD
    Fiddle::TYPE_VOIDP,  # pdv : void* optional
  ],
  Fiddle::TYPE_INT)
#[link(name = "gdi32")]
extern "system" {
    fn RemoveFontResourceExA(
        name: *const u8,  // LPCSTR
        fl: u32,  // DWORD
        pdv: *mut ()  // void* optional
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("GDI32.dll", CharSet = CharSet.Ansi)]
public static extern bool RemoveFontResourceExA([MarshalAs(UnmanagedType.LPStr)] string name, uint fl, IntPtr pdv);
"@
$api = Add-Type -MemberDefinition $sig -Name 'GDI32_RemoveFontResourceExA' -Namespace Win32 -PassThru
# $api::RemoveFontResourceExA(name, fl, pdv)
#uselib "GDI32.dll"
#func global RemoveFontResourceExA "RemoveFontResourceExA" sptr, sptr, sptr
; RemoveFontResourceExA name, fl, pdv   ; 戻り値は stat
; name : LPCSTR -> "sptr"
; fl : DWORD -> "sptr"
; pdv : void* optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "GDI32.dll"
#cfunc global RemoveFontResourceExA "RemoveFontResourceExA" str, int, sptr
; res = RemoveFontResourceExA(name, fl, pdv)
; name : LPCSTR -> "str"
; fl : DWORD -> "int"
; pdv : void* optional -> "sptr"
; BOOL RemoveFontResourceExA(LPCSTR name, DWORD fl, void* pdv)
#uselib "GDI32.dll"
#cfunc global RemoveFontResourceExA "RemoveFontResourceExA" str, int, intptr
; res = RemoveFontResourceExA(name, fl, pdv)
; name : LPCSTR -> "str"
; fl : DWORD -> "int"
; pdv : void* optional -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	gdi32 = windows.NewLazySystemDLL("GDI32.dll")
	procRemoveFontResourceExA = gdi32.NewProc("RemoveFontResourceExA")
)

// name (LPCSTR), fl (DWORD), pdv (void* optional)
r1, _, err := procRemoveFontResourceExA.Call(
	uintptr(unsafe.Pointer(windows.BytePtrFromString(name))),
	uintptr(fl),
	uintptr(pdv),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function RemoveFontResourceExA(
  name: PAnsiChar;   // LPCSTR
  fl: DWORD;   // DWORD
  pdv: Pointer   // void* optional
): BOOL; stdcall;
  external 'GDI32.dll' name 'RemoveFontResourceExA';
result := DllCall("GDI32\RemoveFontResourceExA"
    , "AStr", name   ; LPCSTR
    , "UInt", fl   ; DWORD
    , "Ptr", pdv   ; void* optional
    , "Int")   ; return: BOOL
●RemoveFontResourceExA(name, fl, pdv) = DLL("GDI32.dll", "bool RemoveFontResourceExA(char*, dword, void*)")
# 呼び出し: RemoveFontResourceExA(name, fl, pdv)
# name : LPCSTR -> "char*"
# fl : DWORD -> "dword"
# pdv : void* optional -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。