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

GdipCloneFont

関数
フォントオブジェクトを複製する。
DLLgdiplus.dll呼出規約winapi

シグネチャ

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

Status GdipCloneFont(
    GpFont* font,
    GpFont** cloneFont
);

パラメーター

名前方向
fontGpFont*inout
cloneFontGpFont**inout

戻り値の型: Status

各言語での呼び出し定義

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

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

GdipCloneFont = ctypes.windll.gdiplus.GdipCloneFont
GdipCloneFont.restype = ctypes.c_int
GdipCloneFont.argtypes = [
    ctypes.c_void_p,  # font : GpFont* in/out
    ctypes.c_void_p,  # cloneFont : GpFont** in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	gdiplus = windows.NewLazySystemDLL("gdiplus.dll")
	procGdipCloneFont = gdiplus.NewProc("GdipCloneFont")
)

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