ホーム › Graphics.GdiPlus › GdipCloneStringFormat
GdipCloneStringFormat
関数文字列書式オブジェクトを複製する。
シグネチャ
// gdiplus.dll
#include <windows.h>
Status GdipCloneStringFormat(
const GpStringFormat* format,
GpStringFormat** newFormat
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| format | GpStringFormat* | in | 複製元となる既存のGpStringFormatオブジェクトへのポインタ。 |
| newFormat | GpStringFormat** | inout | 複製された新しいGpStringFormatオブジェクトへのポインタを受け取る出力先。 |
戻り値の型: 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 方式にも切替可。#uselib "gdiplus.dll" #cfunc global GdipCloneStringFormat "GdipCloneStringFormat" sptr, sptr ; res = GdipCloneStringFormat(varptr(format), varptr(newFormat)) ; format : GpStringFormat* -> "sptr" ; newFormat : GpStringFormat** in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは 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 方式にも切替可。; Status GdipCloneStringFormat(GpStringFormat* format, GpStringFormat** newFormat) #uselib "gdiplus.dll" #cfunc global GdipCloneStringFormat "GdipCloneStringFormat" intptr, intptr ; res = GdipCloneStringFormat(varptr(format), varptr(newFormat)) ; format : GpStringFormat* -> "intptr" ; newFormat : GpStringFormat** in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは 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 // Statusfunction 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)。const std = @import("std");
extern "gdiplus" fn GdipCloneStringFormat(
format: [*c]GpStringFormat, // GpStringFormat*
newFormat: [*c][*c]GpStringFormat // GpStringFormat** in/out
) callconv(std.os.windows.WINAPI) i32;proc GdipCloneStringFormat(
format: ptr GpStringFormat, # GpStringFormat*
newFormat: ptr GpStringFormat # GpStringFormat** in/out
): int32 {.importc: "GdipCloneStringFormat", stdcall, dynlib: "gdiplus.dll".}pragma(lib, "gdiplus");
extern(Windows)
int GdipCloneStringFormat(
GpStringFormat* format, // GpStringFormat*
GpStringFormat** newFormat // GpStringFormat** in/out
);ccall((:GdipCloneStringFormat, "gdiplus.dll"), stdcall, Int32,
(Ptr{GpStringFormat}, Ptr{GpStringFormat}),
format, newFormat)
# format : GpStringFormat* -> Ptr{GpStringFormat}
# newFormat : GpStringFormat** in/out -> Ptr{GpStringFormat}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t GdipCloneStringFormat(
void* format,
void* newFormat);
]]
local gdiplus = ffi.load("gdiplus")
-- gdiplus.GdipCloneStringFormat(format, newFormat)
-- format : GpStringFormat*
-- newFormat : GpStringFormat** in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('gdiplus.dll');
const GdipCloneStringFormat = lib.func('__stdcall', 'GdipCloneStringFormat', 'int32_t', ['void *', 'void *']);
// GdipCloneStringFormat(format, newFormat)
// format : GpStringFormat* -> 'void *'
// newFormat : GpStringFormat** in/out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("gdiplus.dll", {
GdipCloneStringFormat: { parameters: ["pointer", "pointer"], result: "i32" },
});
// lib.symbols.GdipCloneStringFormat(format, newFormat)
// format : GpStringFormat* -> "pointer"
// newFormat : GpStringFormat** in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t GdipCloneStringFormat(
void* format,
void* newFormat);
C, "gdiplus.dll");
// $ffi->GdipCloneStringFormat(format, newFormat);
// format : GpStringFormat*
// newFormat : GpStringFormat** in/out
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Gdiplus extends StdCallLibrary {
Gdiplus INSTANCE = Native.load("gdiplus", Gdiplus.class);
int GdipCloneStringFormat(
Pointer format, // GpStringFormat*
Pointer newFormat // GpStringFormat** in/out
);
}@[Link("gdiplus")]
lib Libgdiplus
fun GdipCloneStringFormat = GdipCloneStringFormat(
format : GpStringFormat*, # GpStringFormat*
newFormat : GpStringFormat** # GpStringFormat** in/out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef GdipCloneStringFormatNative = Int32 Function(Pointer<Void>, Pointer<Void>);
typedef GdipCloneStringFormatDart = int Function(Pointer<Void>, Pointer<Void>);
final GdipCloneStringFormat = DynamicLibrary.open('gdiplus.dll')
.lookupFunction<GdipCloneStringFormatNative, GdipCloneStringFormatDart>('GdipCloneStringFormat');
// format : GpStringFormat* -> Pointer<Void>
// newFormat : GpStringFormat** in/out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function GdipCloneStringFormat(
format: Pointer; // GpStringFormat*
newFormat: Pointer // GpStringFormat** in/out
): Integer; stdcall;
external 'gdiplus.dll' name 'GdipCloneStringFormat';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "GdipCloneStringFormat"
c_GdipCloneStringFormat :: Ptr () -> Ptr () -> IO Int32
-- format : GpStringFormat* -> Ptr ()
-- newFormat : GpStringFormat** in/out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let gdipclonestringformat =
foreign "GdipCloneStringFormat"
((ptr void) @-> (ptr void) @-> returning int32_t)
(* format : GpStringFormat* -> (ptr void) *)
(* newFormat : GpStringFormat** in/out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library gdiplus (t "gdiplus.dll"))
(cffi:use-foreign-library gdiplus)
(cffi:defcfun ("GdipCloneStringFormat" gdip-clone-string-format :convention :stdcall) :int32
(format :pointer) ; GpStringFormat*
(new-format :pointer)) ; GpStringFormat** in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $GdipCloneStringFormat = Win32::API::More->new('gdiplus',
'int GdipCloneStringFormat(LPVOID format, LPVOID newFormat)');
# my $ret = $GdipCloneStringFormat->Call($format, $newFormat);
# format : GpStringFormat* -> LPVOID
# newFormat : GpStringFormat** in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。