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

GdipGetBrushType

関数
ブラシの種類(塗りつぶし方式)を取得する。
DLLgdiplus.dll呼出規約winapi

シグネチャ

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

Status GdipGetBrushType(
    GpBrush* brush,
    BrushType* type
);

パラメーター

名前方向
brushGpBrush*inout
typeBrushType*inout

戻り値の型: Status

各言語での呼び出し定義

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

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

GdipGetBrushType = ctypes.windll.gdiplus.GdipGetBrushType
GdipGetBrushType.restype = ctypes.c_int
GdipGetBrushType.argtypes = [
    ctypes.c_void_p,  # brush : GpBrush* in/out
    ctypes.c_void_p,  # type : BrushType* in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	gdiplus = windows.NewLazySystemDLL("gdiplus.dll")
	procGdipGetBrushType = gdiplus.NewProc("GdipGetBrushType")
)

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