Win32 API 日本語リファレンス
ホームUI.WindowsAndMessaging › TileWindows

TileWindows

関数
指定した子ウィンドウをタイル状に並べて配置する。
DLLUSER32.dll呼出規約winapiSetLastErrorあり対応OSWindows 2000 以降

シグネチャ

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

WORD TileWindows(
    HWND hwndParent,   // optional
    TILE_WINDOWS_HOW wHow,
    const RECT* lpRect,   // optional
    DWORD cKids,
    const HWND* lpKids   // optional
);

パラメーター

名前方向
hwndParentHWNDinoptional
wHowTILE_WINDOWS_HOWin
lpRectRECT*inoptional
cKidsDWORDin
lpKidsHWND*inoptional

戻り値の型: WORD

各言語での呼び出し定義

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

WORD TileWindows(
    HWND hwndParent,   // optional
    TILE_WINDOWS_HOW wHow,
    const RECT* lpRect,   // optional
    DWORD cKids,
    const HWND* lpKids   // optional
);
[DllImport("USER32.dll", SetLastError = true, ExactSpelling = true)]
static extern ushort TileWindows(
    IntPtr hwndParent,   // HWND optional
    uint wHow,   // TILE_WINDOWS_HOW
    IntPtr lpRect,   // RECT* optional
    uint cKids,   // DWORD
    IntPtr lpKids   // HWND* optional
);
<DllImport("USER32.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function TileWindows(
    hwndParent As IntPtr,   ' HWND optional
    wHow As UInteger,   ' TILE_WINDOWS_HOW
    lpRect As IntPtr,   ' RECT* optional
    cKids As UInteger,   ' DWORD
    lpKids As IntPtr   ' HWND* optional
) As UShort
End Function
' hwndParent : HWND optional
' wHow : TILE_WINDOWS_HOW
' lpRect : RECT* optional
' cKids : DWORD
' lpKids : HWND* optional
Declare PtrSafe Function TileWindows Lib "user32" ( _
    ByVal hwndParent As LongPtr, _
    ByVal wHow As Long, _
    ByVal lpRect As LongPtr, _
    ByVal cKids As Long, _
    ByVal lpKids As LongPtr) As Integer
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

TileWindows = ctypes.windll.user32.TileWindows
TileWindows.restype = ctypes.c_ushort
TileWindows.argtypes = [
    wintypes.HANDLE,  # hwndParent : HWND optional
    wintypes.DWORD,  # wHow : TILE_WINDOWS_HOW
    ctypes.c_void_p,  # lpRect : RECT* optional
    wintypes.DWORD,  # cKids : DWORD
    ctypes.c_void_p,  # lpKids : HWND* optional
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('USER32.dll')
TileWindows = Fiddle::Function.new(
  lib['TileWindows'],
  [
    Fiddle::TYPE_VOIDP,  # hwndParent : HWND optional
    -Fiddle::TYPE_INT,  # wHow : TILE_WINDOWS_HOW
    Fiddle::TYPE_VOIDP,  # lpRect : RECT* optional
    -Fiddle::TYPE_INT,  # cKids : DWORD
    Fiddle::TYPE_VOIDP,  # lpKids : HWND* optional
  ],
  -Fiddle::TYPE_SHORT)
#[link(name = "user32")]
extern "system" {
    fn TileWindows(
        hwndParent: *mut core::ffi::c_void,  // HWND optional
        wHow: u32,  // TILE_WINDOWS_HOW
        lpRect: *const RECT,  // RECT* optional
        cKids: u32,  // DWORD
        lpKids: *mut *mut core::ffi::c_void  // HWND* optional
    ) -> u16;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("USER32.dll", SetLastError = true)]
public static extern ushort TileWindows(IntPtr hwndParent, uint wHow, IntPtr lpRect, uint cKids, IntPtr lpKids);
"@
$api = Add-Type -MemberDefinition $sig -Name 'USER32_TileWindows' -Namespace Win32 -PassThru
# $api::TileWindows(hwndParent, wHow, lpRect, cKids, lpKids)
#uselib "USER32.dll"
#func global TileWindows "TileWindows" sptr, sptr, sptr, sptr, sptr
; TileWindows hwndParent, wHow, varptr(lpRect), cKids, lpKids   ; 戻り値は stat
; hwndParent : HWND optional -> "sptr"
; wHow : TILE_WINDOWS_HOW -> "sptr"
; lpRect : RECT* optional -> "sptr"
; cKids : DWORD -> "sptr"
; lpKids : HWND* optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "USER32.dll"
#cfunc global TileWindows "TileWindows" sptr, int, var, int, sptr
; res = TileWindows(hwndParent, wHow, lpRect, cKids, lpKids)
; hwndParent : HWND optional -> "sptr"
; wHow : TILE_WINDOWS_HOW -> "int"
; lpRect : RECT* optional -> "var"
; cKids : DWORD -> "int"
; lpKids : HWND* optional -> "sptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; WORD TileWindows(HWND hwndParent, TILE_WINDOWS_HOW wHow, RECT* lpRect, DWORD cKids, HWND* lpKids)
#uselib "USER32.dll"
#cfunc global TileWindows "TileWindows" intptr, int, var, int, intptr
; res = TileWindows(hwndParent, wHow, lpRect, cKids, lpKids)
; hwndParent : HWND optional -> "intptr"
; wHow : TILE_WINDOWS_HOW -> "int"
; lpRect : RECT* optional -> "var"
; cKids : DWORD -> "int"
; lpKids : HWND* optional -> "intptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	user32 = windows.NewLazySystemDLL("USER32.dll")
	procTileWindows = user32.NewProc("TileWindows")
)

// hwndParent (HWND optional), wHow (TILE_WINDOWS_HOW), lpRect (RECT* optional), cKids (DWORD), lpKids (HWND* optional)
r1, _, err := procTileWindows.Call(
	uintptr(hwndParent),
	uintptr(wHow),
	uintptr(lpRect),
	uintptr(cKids),
	uintptr(lpKids),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // WORD
function TileWindows(
  hwndParent: THandle;   // HWND optional
  wHow: DWORD;   // TILE_WINDOWS_HOW
  lpRect: Pointer;   // RECT* optional
  cKids: DWORD;   // DWORD
  lpKids: Pointer   // HWND* optional
): Word; stdcall;
  external 'USER32.dll' name 'TileWindows';
result := DllCall("USER32\TileWindows"
    , "Ptr", hwndParent   ; HWND optional
    , "UInt", wHow   ; TILE_WINDOWS_HOW
    , "Ptr", lpRect   ; RECT* optional
    , "UInt", cKids   ; DWORD
    , "Ptr", lpKids   ; HWND* optional
    , "UShort")   ; return: WORD
●TileWindows(hwndParent, wHow, lpRect, cKids, lpKids) = DLL("USER32.dll", "int TileWindows(void*, dword, void*, dword, void*)")
# 呼び出し: TileWindows(hwndParent, wHow, lpRect, cKids, lpKids)
# hwndParent : HWND optional -> "void*"
# wHow : TILE_WINDOWS_HOW -> "dword"
# lpRect : RECT* optional -> "void*"
# cKids : DWORD -> "dword"
# lpKids : HWND* optional -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。