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