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

GdipClonePen

関数
既存のペンを複製して新しいペンオブジェクトを作成する。
DLLgdiplus.dll呼出規約winapi

シグネチャ

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

Status GdipClonePen(
    GpPen* pen,
    GpPen** clonepen
);

パラメーター

名前方向
penGpPen*inout
clonepenGpPen**inout

戻り値の型: Status

各言語での呼び出し定義

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

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

GdipClonePen = ctypes.windll.gdiplus.GdipClonePen
GdipClonePen.restype = ctypes.c_int
GdipClonePen.argtypes = [
    ctypes.c_void_p,  # pen : GpPen* in/out
    ctypes.c_void_p,  # clonepen : GpPen** in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	gdiplus = windows.NewLazySystemDLL("gdiplus.dll")
	procGdipClonePen = gdiplus.NewProc("GdipClonePen")
)

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