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