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

GdipCloneStringFormat

関数
文字列書式オブジェクトを複製する。
DLLgdiplus.dll呼出規約winapi

シグネチャ

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

Status GdipCloneStringFormat(
    const GpStringFormat* format,
    GpStringFormat** newFormat
);

パラメーター

名前方向
formatGpStringFormat*in
newFormatGpStringFormat**inout

戻り値の型: Status

各言語での呼び出し定義

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

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

GdipCloneStringFormat = ctypes.windll.gdiplus.GdipCloneStringFormat
GdipCloneStringFormat.restype = ctypes.c_int
GdipCloneStringFormat.argtypes = [
    ctypes.c_void_p,  # format : GpStringFormat*
    ctypes.c_void_p,  # newFormat : GpStringFormat** in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	gdiplus = windows.NewLazySystemDLL("gdiplus.dll")
	procGdipCloneStringFormat = gdiplus.NewProc("GdipCloneStringFormat")
)

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