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

GetMiterLimit

関数
DCの現在のマイター長制限値を取得する。
DLLGDI32.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

BOOL GetMiterLimit(
    HDC hdc,
    FLOAT* plimit
);

パラメーター

名前方向
hdcHDCin
plimitFLOAT*out

戻り値の型: BOOL

各言語での呼び出し定義

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

BOOL GetMiterLimit(
    HDC hdc,
    FLOAT* plimit
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("GDI32.dll", ExactSpelling = true)]
static extern bool GetMiterLimit(
    IntPtr hdc,   // HDC
    out float plimit   // FLOAT* out
);
<DllImport("GDI32.dll", ExactSpelling:=True)>
Public Shared Function GetMiterLimit(
    hdc As IntPtr,   ' HDC
    <Out> ByRef plimit As Single   ' FLOAT* out
) As Boolean
End Function
' hdc : HDC
' plimit : FLOAT* out
Declare PtrSafe Function GetMiterLimit Lib "gdi32" ( _
    ByVal hdc As LongPtr, _
    ByRef plimit As Single) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

GetMiterLimit = ctypes.windll.gdi32.GetMiterLimit
GetMiterLimit.restype = wintypes.BOOL
GetMiterLimit.argtypes = [
    wintypes.HANDLE,  # hdc : HDC
    ctypes.POINTER(ctypes.c_float),  # plimit : FLOAT* out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('GDI32.dll')
GetMiterLimit = Fiddle::Function.new(
  lib['GetMiterLimit'],
  [
    Fiddle::TYPE_VOIDP,  # hdc : HDC
    Fiddle::TYPE_VOIDP,  # plimit : FLOAT* out
  ],
  Fiddle::TYPE_INT)
#[link(name = "gdi32")]
extern "system" {
    fn GetMiterLimit(
        hdc: *mut core::ffi::c_void,  // HDC
        plimit: *mut f32  // FLOAT* out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("GDI32.dll")]
public static extern bool GetMiterLimit(IntPtr hdc, out float plimit);
"@
$api = Add-Type -MemberDefinition $sig -Name 'GDI32_GetMiterLimit' -Namespace Win32 -PassThru
# $api::GetMiterLimit(hdc, plimit)
#uselib "GDI32.dll"
#func global GetMiterLimit "GetMiterLimit" sptr, sptr
; GetMiterLimit hdc, varptr(plimit)   ; 戻り値は stat
; hdc : HDC -> "sptr"
; plimit : FLOAT* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "GDI32.dll"
#cfunc global GetMiterLimit "GetMiterLimit" sptr, var
; res = GetMiterLimit(hdc, plimit)
; hdc : HDC -> "sptr"
; plimit : FLOAT* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; BOOL GetMiterLimit(HDC hdc, FLOAT* plimit)
#uselib "GDI32.dll"
#cfunc global GetMiterLimit "GetMiterLimit" intptr, var
; res = GetMiterLimit(hdc, plimit)
; hdc : HDC -> "intptr"
; plimit : FLOAT* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	gdi32 = windows.NewLazySystemDLL("GDI32.dll")
	procGetMiterLimit = gdi32.NewProc("GetMiterLimit")
)

// hdc (HDC), plimit (FLOAT* out)
r1, _, err := procGetMiterLimit.Call(
	uintptr(hdc),
	uintptr(plimit),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function GetMiterLimit(
  hdc: THandle;   // HDC
  plimit: Pointer   // FLOAT* out
): BOOL; stdcall;
  external 'GDI32.dll' name 'GetMiterLimit';
result := DllCall("GDI32\GetMiterLimit"
    , "Ptr", hdc   ; HDC
    , "Ptr", plimit   ; FLOAT* out
    , "Int")   ; return: BOOL
●GetMiterLimit(hdc, plimit) = DLL("GDI32.dll", "bool GetMiterLimit(void*, void*)")
# 呼び出し: GetMiterLimit(hdc, plimit)
# hdc : HDC -> "void*"
# plimit : FLOAT* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。