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