Win32 API 日本語リファレンス
ホームDevices.Display › BRUSHOBJ_pvAllocRbrush

BRUSHOBJ_pvAllocRbrush

関数
ブラシオブジェクトに実現済みブラシ用メモリを確保する。
DLLGDI32.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

void* BRUSHOBJ_pvAllocRbrush(
    BRUSHOBJ* pbo,
    DWORD cj
);

パラメーター

名前方向
pboBRUSHOBJ*inout
cjDWORDin

戻り値の型: void*

各言語での呼び出し定義

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

void* BRUSHOBJ_pvAllocRbrush(
    BRUSHOBJ* pbo,
    DWORD cj
);
[DllImport("GDI32.dll", ExactSpelling = true)]
static extern IntPtr BRUSHOBJ_pvAllocRbrush(
    IntPtr pbo,   // BRUSHOBJ* in/out
    uint cj   // DWORD
);
<DllImport("GDI32.dll", ExactSpelling:=True)>
Public Shared Function BRUSHOBJ_pvAllocRbrush(
    pbo As IntPtr,   ' BRUSHOBJ* in/out
    cj As UInteger   ' DWORD
) As IntPtr
End Function
' pbo : BRUSHOBJ* in/out
' cj : DWORD
Declare PtrSafe Function BRUSHOBJ_pvAllocRbrush Lib "gdi32" ( _
    ByVal pbo As LongPtr, _
    ByVal cj As Long) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

BRUSHOBJ_pvAllocRbrush = ctypes.windll.gdi32.BRUSHOBJ_pvAllocRbrush
BRUSHOBJ_pvAllocRbrush.restype = ctypes.c_void_p
BRUSHOBJ_pvAllocRbrush.argtypes = [
    ctypes.c_void_p,  # pbo : BRUSHOBJ* in/out
    wintypes.DWORD,  # cj : DWORD
]
require 'fiddle'
require 'fiddle/import'

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

var (
	gdi32 = windows.NewLazySystemDLL("GDI32.dll")
	procBRUSHOBJ_pvAllocRbrush = gdi32.NewProc("BRUSHOBJ_pvAllocRbrush")
)

// pbo (BRUSHOBJ* in/out), cj (DWORD)
r1, _, err := procBRUSHOBJ_pvAllocRbrush.Call(
	uintptr(pbo),
	uintptr(cj),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // void*
function BRUSHOBJ_pvAllocRbrush(
  pbo: Pointer;   // BRUSHOBJ* in/out
  cj: DWORD   // DWORD
): Pointer; stdcall;
  external 'GDI32.dll' name 'BRUSHOBJ_pvAllocRbrush';
result := DllCall("GDI32\BRUSHOBJ_pvAllocRbrush"
    , "Ptr", pbo   ; BRUSHOBJ* in/out
    , "UInt", cj   ; DWORD
    , "Ptr")   ; return: void*
●BRUSHOBJ_pvAllocRbrush(pbo, cj) = DLL("GDI32.dll", "void* BRUSHOBJ_pvAllocRbrush(void*, dword)")
# 呼び出し: BRUSHOBJ_pvAllocRbrush(pbo, cj)
# pbo : BRUSHOBJ* in/out -> "void*"
# cj : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。