ホーム › Graphics.Gdi › CreatePenIndirect
CreatePenIndirect
関数LOGPEN構造体の指定に基づいてペンを作成する。
シグネチャ
// GDI32.dll
#include <windows.h>
HPEN CreatePenIndirect(
const LOGPEN* plpen
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| plpen | LOGPEN* | in |
戻り値の型: HPEN
各言語での呼び出し定義
// GDI32.dll
#include <windows.h>
HPEN CreatePenIndirect(
const LOGPEN* plpen
);[DllImport("GDI32.dll", ExactSpelling = true)]
static extern IntPtr CreatePenIndirect(
IntPtr plpen // LOGPEN*
);<DllImport("GDI32.dll", ExactSpelling:=True)>
Public Shared Function CreatePenIndirect(
plpen As IntPtr ' LOGPEN*
) As IntPtr
End Function' plpen : LOGPEN*
Declare PtrSafe Function CreatePenIndirect Lib "gdi32" ( _
ByVal plpen As LongPtr) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
CreatePenIndirect = ctypes.windll.gdi32.CreatePenIndirect
CreatePenIndirect.restype = ctypes.c_void_p
CreatePenIndirect.argtypes = [
ctypes.c_void_p, # plpen : LOGPEN*
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('GDI32.dll')
CreatePenIndirect = Fiddle::Function.new(
lib['CreatePenIndirect'],
[
Fiddle::TYPE_VOIDP, # plpen : LOGPEN*
],
Fiddle::TYPE_VOIDP)#[link(name = "gdi32")]
extern "system" {
fn CreatePenIndirect(
plpen: *const LOGPEN // LOGPEN*
) -> *mut core::ffi::c_void;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("GDI32.dll")]
public static extern IntPtr CreatePenIndirect(IntPtr plpen);
"@
$api = Add-Type -MemberDefinition $sig -Name 'GDI32_CreatePenIndirect' -Namespace Win32 -PassThru
# $api::CreatePenIndirect(plpen)#uselib "GDI32.dll"
#func global CreatePenIndirect "CreatePenIndirect" sptr
; CreatePenIndirect varptr(plpen) ; 戻り値は stat
; plpen : LOGPEN* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "GDI32.dll" #cfunc global CreatePenIndirect "CreatePenIndirect" var ; res = CreatePenIndirect(plpen) ; plpen : LOGPEN* -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "GDI32.dll" #cfunc global CreatePenIndirect "CreatePenIndirect" sptr ; res = CreatePenIndirect(varptr(plpen)) ; plpen : LOGPEN* -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HPEN CreatePenIndirect(LOGPEN* plpen) #uselib "GDI32.dll" #cfunc global CreatePenIndirect "CreatePenIndirect" var ; res = CreatePenIndirect(plpen) ; plpen : LOGPEN* -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HPEN CreatePenIndirect(LOGPEN* plpen) #uselib "GDI32.dll" #cfunc global CreatePenIndirect "CreatePenIndirect" intptr ; res = CreatePenIndirect(varptr(plpen)) ; plpen : LOGPEN* -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
gdi32 = windows.NewLazySystemDLL("GDI32.dll")
procCreatePenIndirect = gdi32.NewProc("CreatePenIndirect")
)
// plpen (LOGPEN*)
r1, _, err := procCreatePenIndirect.Call(
uintptr(plpen),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HPENfunction CreatePenIndirect(
plpen: Pointer // LOGPEN*
): THandle; stdcall;
external 'GDI32.dll' name 'CreatePenIndirect';result := DllCall("GDI32\CreatePenIndirect"
, "Ptr", plpen ; LOGPEN*
, "Ptr") ; return: HPEN●CreatePenIndirect(plpen) = DLL("GDI32.dll", "void* CreatePenIndirect(void*)")
# 呼び出し: CreatePenIndirect(plpen)
# plpen : LOGPEN* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。