Function Reference


_WinAPI_GetEffectiveClientRect

Calculates the dimensions of a rectangle in the client area that contains all the specified controls

#include <WinAPISys.au3>
_WinAPI_GetEffectiveClientRect ( $hWnd, $aCtrl [, $iStart = 0 [, $iEnd = -1]] )

Parameters

$hWnd A handle to the window that has the client area to check.
$aCtrl The array containing the handles or identifiers of the controls that should be included in the calculation of the client area. Also, it can be a single handle or control identifier.
$iStart [optional] The index of array element that contains the first control.
$iEnd [optional] The index of array element that contains the last control.

Return Value

Success: $tagRECT structure that contains the rectangle with effective client area.
Failure: Sets the @error flag to non-zero.

Remarks

If the control in the array is visible, or will be visible when its parent becomes visible, its rectangle is subtracted from the effective client rectangle.

If all the specified controls is missing, the function returns the client area of the parent window.

See Also

Search GetEffectiveClientRect in MSDN Library.

Example

#include <GUIConstantsEx.au3>
#include <GUIStatusBar.au3>
#include <StaticConstants.au3>
#include <WinAPIGdi.au3>
#include <WinAPISys.au3>

; Create GUI
Local $hForm = GUICreate('Test ' & StringReplace(@ScriptName, '.au3', '()'), 600, 400)
Local $idMenu = GUICtrlCreateMenu("&File")
Local $idExit = GUICtrlCreateMenuItem("E&xit", $idMenu)
Local $a_vID[2]
$a_vID[0] = _GUICtrlStatusBar_Create($hForm)
$a_vID[1] = GUICtrlCreateListView('', 0, 0, 600, 200, -1, 0)

; Calculate effective client area (excluding Menu, ListView, and StatusBar controls)
Local $tRECT = _WinAPI_GetEffectiveClientRect($hForm, $a_vID)
Local $aPos = _WinAPI_GetPosFromRect($tRECT)
GUICtrlCreateLabel($aPos[2] & 'x' & $aPos[3], $aPos[0], $aPos[1], $aPos[2], $aPos[3], BitOR($SS_CENTER, $SS_CENTERIMAGE))
GUICtrlSetFont(-1, 25, 400, 0, 'Tahoma')
GUICtrlSetBkColor(-1, 0xFFD0D0)

; Show GUI
GUISetState(@SW_SHOW)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE, $idExit
            ExitLoop
    EndSwitch
WEnd