ホーム › Graphics.Gdi › SetRectRgn
SetRectRgn
関数既存のリージョンを指定した矩形リージョンに設定する。
シグネチャ
// GDI32.dll
#include <windows.h>
BOOL SetRectRgn(
HRGN hrgn,
INT left,
INT top,
INT right,
INT bottom
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hrgn | HRGN | in |
| left | INT | in |
| top | INT | in |
| right | INT | in |
| bottom | INT | in |
戻り値の型: BOOL
各言語での呼び出し定義
// GDI32.dll
#include <windows.h>
BOOL SetRectRgn(
HRGN hrgn,
INT left,
INT top,
INT right,
INT bottom
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("GDI32.dll", ExactSpelling = true)]
static extern bool SetRectRgn(
IntPtr hrgn, // HRGN
int left, // INT
int top, // INT
int right, // INT
int bottom // INT
);<DllImport("GDI32.dll", ExactSpelling:=True)>
Public Shared Function SetRectRgn(
hrgn As IntPtr, ' HRGN
left As Integer, ' INT
top As Integer, ' INT
right As Integer, ' INT
bottom As Integer ' INT
) As Boolean
End Function' hrgn : HRGN
' left : INT
' top : INT
' right : INT
' bottom : INT
Declare PtrSafe Function SetRectRgn Lib "gdi32" ( _
ByVal hrgn As LongPtr, _
ByVal left As Long, _
ByVal top As Long, _
ByVal right As Long, _
ByVal bottom As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
SetRectRgn = ctypes.windll.gdi32.SetRectRgn
SetRectRgn.restype = wintypes.BOOL
SetRectRgn.argtypes = [
wintypes.HANDLE, # hrgn : HRGN
ctypes.c_int, # left : INT
ctypes.c_int, # top : INT
ctypes.c_int, # right : INT
ctypes.c_int, # bottom : INT
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('GDI32.dll')
SetRectRgn = Fiddle::Function.new(
lib['SetRectRgn'],
[
Fiddle::TYPE_VOIDP, # hrgn : HRGN
Fiddle::TYPE_INT, # left : INT
Fiddle::TYPE_INT, # top : INT
Fiddle::TYPE_INT, # right : INT
Fiddle::TYPE_INT, # bottom : INT
],
Fiddle::TYPE_INT)#[link(name = "gdi32")]
extern "system" {
fn SetRectRgn(
hrgn: *mut core::ffi::c_void, // HRGN
left: i32, // INT
top: i32, // INT
right: i32, // INT
bottom: i32 // INT
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("GDI32.dll")]
public static extern bool SetRectRgn(IntPtr hrgn, int left, int top, int right, int bottom);
"@
$api = Add-Type -MemberDefinition $sig -Name 'GDI32_SetRectRgn' -Namespace Win32 -PassThru
# $api::SetRectRgn(hrgn, left, top, right, bottom)#uselib "GDI32.dll"
#func global SetRectRgn "SetRectRgn" sptr, sptr, sptr, sptr, sptr
; SetRectRgn hrgn, left, top, right, bottom ; 戻り値は stat
; hrgn : HRGN -> "sptr"
; left : INT -> "sptr"
; top : INT -> "sptr"
; right : INT -> "sptr"
; bottom : INT -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "GDI32.dll"
#cfunc global SetRectRgn "SetRectRgn" sptr, int, int, int, int
; res = SetRectRgn(hrgn, left, top, right, bottom)
; hrgn : HRGN -> "sptr"
; left : INT -> "int"
; top : INT -> "int"
; right : INT -> "int"
; bottom : INT -> "int"; BOOL SetRectRgn(HRGN hrgn, INT left, INT top, INT right, INT bottom)
#uselib "GDI32.dll"
#cfunc global SetRectRgn "SetRectRgn" intptr, int, int, int, int
; res = SetRectRgn(hrgn, left, top, right, bottom)
; hrgn : HRGN -> "intptr"
; left : INT -> "int"
; top : INT -> "int"
; right : INT -> "int"
; bottom : INT -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
gdi32 = windows.NewLazySystemDLL("GDI32.dll")
procSetRectRgn = gdi32.NewProc("SetRectRgn")
)
// hrgn (HRGN), left (INT), top (INT), right (INT), bottom (INT)
r1, _, err := procSetRectRgn.Call(
uintptr(hrgn),
uintptr(left),
uintptr(top),
uintptr(right),
uintptr(bottom),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction SetRectRgn(
hrgn: THandle; // HRGN
left: Integer; // INT
top: Integer; // INT
right: Integer; // INT
bottom: Integer // INT
): BOOL; stdcall;
external 'GDI32.dll' name 'SetRectRgn';result := DllCall("GDI32\SetRectRgn"
, "Ptr", hrgn ; HRGN
, "Int", left ; INT
, "Int", top ; INT
, "Int", right ; INT
, "Int", bottom ; INT
, "Int") ; return: BOOL●SetRectRgn(hrgn, left, top, right, bottom) = DLL("GDI32.dll", "bool SetRectRgn(void*, int, int, int, int)")
# 呼び出し: SetRectRgn(hrgn, left, top, right, bottom)
# hrgn : HRGN -> "void*"
# left : INT -> "int"
# top : INT -> "int"
# right : INT -> "int"
# bottom : INT -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。