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

RemoveFontResourceExW

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

シグネチャ

// GDI32.dll  (Unicode / -W)
#include <windows.h>

BOOL RemoveFontResourceExW(
    LPCWSTR name,
    DWORD fl,
    void* pdv   // optional
);

パラメーター

名前方向
nameLPCWSTRin
flDWORDin
pdvvoid*optional

戻り値の型: BOOL

各言語での呼び出し定義

// GDI32.dll  (Unicode / -W)
#include <windows.h>

BOOL RemoveFontResourceExW(
    LPCWSTR name,
    DWORD fl,
    void* pdv   // optional
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("GDI32.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern bool RemoveFontResourceExW(
    [MarshalAs(UnmanagedType.LPWStr)] string name,   // LPCWSTR
    uint fl,   // DWORD
    IntPtr pdv   // void* optional
);
<DllImport("GDI32.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function RemoveFontResourceExW(
    <MarshalAs(UnmanagedType.LPWStr)> name As String,   ' LPCWSTR
    fl As UInteger,   ' DWORD
    pdv As IntPtr   ' void* optional
) As Boolean
End Function
' name : LPCWSTR
' fl : DWORD
' pdv : void* optional
Declare PtrSafe Function RemoveFontResourceExW Lib "gdi32" ( _
    ByVal name As LongPtr, _
    ByVal fl As Long, _
    ByVal pdv As LongPtr) As Long
' Unicode(W): 文字列は ByVal As LongPtr とし StrPtr(unicodeStr) を渡す
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

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

lib = Fiddle.dlopen('GDI32.dll')
RemoveFontResourceExW = Fiddle::Function.new(
  lib['RemoveFontResourceExW'],
  [
    Fiddle::TYPE_VOIDP,  # name : LPCWSTR
    -Fiddle::TYPE_INT,  # fl : DWORD
    Fiddle::TYPE_VOIDP,  # pdv : void* optional
  ],
  Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"
#[link(name = "gdi32")]
extern "system" {
    fn RemoveFontResourceExW(
        name: *const u16,  // LPCWSTR
        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.Unicode)]
public static extern bool RemoveFontResourceExW([MarshalAs(UnmanagedType.LPWStr)] string name, uint fl, IntPtr pdv);
"@
$api = Add-Type -MemberDefinition $sig -Name 'GDI32_RemoveFontResourceExW' -Namespace Win32 -PassThru
# $api::RemoveFontResourceExW(name, fl, pdv)
#uselib "GDI32.dll"
#func global RemoveFontResourceExW "RemoveFontResourceExW" wptr, wptr, wptr
; RemoveFontResourceExW name, fl, pdv   ; 戻り値は stat
; name : LPCWSTR -> "wptr"
; fl : DWORD -> "wptr"
; pdv : void* optional -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "GDI32.dll"
#cfunc global RemoveFontResourceExW "RemoveFontResourceExW" wstr, int, sptr
; res = RemoveFontResourceExW(name, fl, pdv)
; name : LPCWSTR -> "wstr"
; fl : DWORD -> "int"
; pdv : void* optional -> "sptr"
; BOOL RemoveFontResourceExW(LPCWSTR name, DWORD fl, void* pdv)
#uselib "GDI32.dll"
#cfunc global RemoveFontResourceExW "RemoveFontResourceExW" wstr, int, intptr
; res = RemoveFontResourceExW(name, fl, pdv)
; name : LPCWSTR -> "wstr"
; fl : DWORD -> "int"
; pdv : void* optional -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	gdi32 = windows.NewLazySystemDLL("GDI32.dll")
	procRemoveFontResourceExW = gdi32.NewProc("RemoveFontResourceExW")
)

// name (LPCWSTR), fl (DWORD), pdv (void* optional)
r1, _, err := procRemoveFontResourceExW.Call(
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(name))),
	uintptr(fl),
	uintptr(pdv),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function RemoveFontResourceExW(
  name: PWideChar;   // LPCWSTR
  fl: DWORD;   // DWORD
  pdv: Pointer   // void* optional
): BOOL; stdcall;
  external 'GDI32.dll' name 'RemoveFontResourceExW';
result := DllCall("GDI32\RemoveFontResourceExW"
    , "WStr", name   ; LPCWSTR
    , "UInt", fl   ; DWORD
    , "Ptr", pdv   ; void* optional
    , "Int")   ; return: BOOL
●RemoveFontResourceExW(name, fl, pdv) = DLL("GDI32.dll", "bool RemoveFontResourceExW(char*, dword, void*)")
# 呼び出し: RemoveFontResourceExW(name, fl, pdv)
# name : LPCWSTR -> "char*"
# fl : DWORD -> "dword"
# pdv : void* optional -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。