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

GetEffectiveClientRect

関数
指定コントロールを除いた有効クライアント領域を計算する。
DLLCOMCTL32.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

void GetEffectiveClientRect(
    HWND hWnd,
    RECT* lprc,
    const INT* lpInfo
);

パラメーター

名前方向
hWndHWNDin
lprcRECT*out
lpInfoINT*in

戻り値の型: void

各言語での呼び出し定義

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

void GetEffectiveClientRect(
    HWND hWnd,
    RECT* lprc,
    const INT* lpInfo
);
[DllImport("COMCTL32.dll", ExactSpelling = true)]
static extern void GetEffectiveClientRect(
    IntPtr hWnd,   // HWND
    IntPtr lprc,   // RECT* out
    ref int lpInfo   // INT*
);
<DllImport("COMCTL32.dll", ExactSpelling:=True)>
Public Shared Sub GetEffectiveClientRect(
    hWnd As IntPtr,   ' HWND
    lprc As IntPtr,   ' RECT* out
    ByRef lpInfo As Integer   ' INT*
)
End Sub
' hWnd : HWND
' lprc : RECT* out
' lpInfo : INT*
Declare PtrSafe Sub GetEffectiveClientRect Lib "comctl32" ( _
    ByVal hWnd As LongPtr, _
    ByVal lprc As LongPtr, _
    ByRef lpInfo As Long)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

GetEffectiveClientRect = ctypes.windll.comctl32.GetEffectiveClientRect
GetEffectiveClientRect.restype = None
GetEffectiveClientRect.argtypes = [
    wintypes.HANDLE,  # hWnd : HWND
    ctypes.c_void_p,  # lprc : RECT* out
    ctypes.POINTER(ctypes.c_int),  # lpInfo : INT*
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('COMCTL32.dll')
GetEffectiveClientRect = Fiddle::Function.new(
  lib['GetEffectiveClientRect'],
  [
    Fiddle::TYPE_VOIDP,  # hWnd : HWND
    Fiddle::TYPE_VOIDP,  # lprc : RECT* out
    Fiddle::TYPE_VOIDP,  # lpInfo : INT*
  ],
  Fiddle::TYPE_VOID)
#[link(name = "comctl32")]
extern "system" {
    fn GetEffectiveClientRect(
        hWnd: *mut core::ffi::c_void,  // HWND
        lprc: *mut RECT,  // RECT* out
        lpInfo: *const i32  // INT*
    );
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("COMCTL32.dll")]
public static extern void GetEffectiveClientRect(IntPtr hWnd, IntPtr lprc, ref int lpInfo);
"@
$api = Add-Type -MemberDefinition $sig -Name 'COMCTL32_GetEffectiveClientRect' -Namespace Win32 -PassThru
# $api::GetEffectiveClientRect(hWnd, lprc, lpInfo)
#uselib "COMCTL32.dll"
#func global GetEffectiveClientRect "GetEffectiveClientRect" sptr, sptr, sptr
; GetEffectiveClientRect hWnd, varptr(lprc), varptr(lpInfo)
; hWnd : HWND -> "sptr"
; lprc : RECT* out -> "sptr"
; lpInfo : INT* -> "sptr"
出力引数:
#uselib "COMCTL32.dll"
#func global GetEffectiveClientRect "GetEffectiveClientRect" sptr, var, var
; GetEffectiveClientRect hWnd, lprc, lpInfo
; hWnd : HWND -> "sptr"
; lprc : RECT* out -> "var"
; lpInfo : INT* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; void GetEffectiveClientRect(HWND hWnd, RECT* lprc, INT* lpInfo)
#uselib "COMCTL32.dll"
#func global GetEffectiveClientRect "GetEffectiveClientRect" intptr, var, var
; GetEffectiveClientRect hWnd, lprc, lpInfo
; hWnd : HWND -> "intptr"
; lprc : RECT* out -> "var"
; lpInfo : INT* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	comctl32 = windows.NewLazySystemDLL("COMCTL32.dll")
	procGetEffectiveClientRect = comctl32.NewProc("GetEffectiveClientRect")
)

// hWnd (HWND), lprc (RECT* out), lpInfo (INT*)
r1, _, err := procGetEffectiveClientRect.Call(
	uintptr(hWnd),
	uintptr(lprc),
	uintptr(lpInfo),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // void
procedure GetEffectiveClientRect(
  hWnd: THandle;   // HWND
  lprc: Pointer;   // RECT* out
  lpInfo: Pointer   // INT*
); stdcall;
  external 'COMCTL32.dll' name 'GetEffectiveClientRect';
result := DllCall("COMCTL32\GetEffectiveClientRect"
    , "Ptr", hWnd   ; HWND
    , "Ptr", lprc   ; RECT* out
    , "Ptr", lpInfo   ; INT*
    , "Int")   ; return: void
●GetEffectiveClientRect(hWnd, lprc, lpInfo) = DLL("COMCTL32.dll", "int GetEffectiveClientRect(void*, void*, void*)")
# 呼び出し: GetEffectiveClientRect(hWnd, lprc, lpInfo)
# hWnd : HWND -> "void*"
# lprc : RECT* out -> "void*"
# lpInfo : INT* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。