[Overview][Types][Procedures and functions][Variables][Index] | Reference for unit 'LCLIntf' (#lcl)

# GetWindowLong

Returns attributes for the specified window handle.

## Declaration

Source position: winapih.inc line 159

`function GetWindowLong(`
`Handle: HWND;`
`int: Integer`
`):PtrInt;`

## Arguments

`Handle` |  | Handle for the window with attributes retrieved in the routine.
`int` |  | Ordinal position for the attributes retrieved for the window handle.

## Function result

Pointer to the Integer value which represents the attributes for the specified window Handle.

## Description

GetWindowLong is a PtrInt function used to retrieve specific attributes for the window represented by Handle. GetWindowLong provides access to the corresponding method in the widgetset class instances. GetWindowLong is Windows-specific; the implementation for other widgetsets simply returns a 0 value.

Handle is the HWND value used as the handle for the Window examined in the routine.

int is an Integer value which contains the 0-based offset to the Cardinal values returned by the routine.

The following values defined in lcltype.pp are allowed in the int argument:

GWL_WNDPROC (-4)
  Gets the address or handle for the window procedure.
GWL_HINSTANCE (-6)
  Gets the handle for the application.
GWL_HWNDPARENT (-8)
  Gets the handle for the parent window (when available).
GWL_ID (-12)
  Gets the identifier for the window.
GWL_STYLE (-16)
  Gets the style flags for the window.
GWL_EXSTYLE (-20)
  Gets the extended style flags for the window.
GWL_USERDATA (-21)
  Gets arbitrary user-defined data for the window; the content and use of the data is application-specific. The default value is zero (0).

The return value contains the attributes for the value requested in int. If the function fails, the return value is zero (0). If SetWindowLong has not been called to store the specified values, GetWindowLong returns zero (0).