GetWindowLong

  LONG GetWindowLong(hwnd, nIndex)    
  HWND hwnd; /* handle of window */
  int nIndex; /* offset of value to retrieve */

This function retrieves information about the window identified by the hwnd parameter.

Parameters

hwnd

Identifies the window.

nIndex

Specifies the byte offset of the value to be retrieved. It can also be one of the following values:

Value Meaning

GWL_EXSTYLE  
  Extended window style.
GWL_STYLE  
  Window style
GWL_WNDPROC  
  Long pointer to the window function
GWL_HINSTANCE  
  Handle of the instance.
GWL_HWNDPARENT  
  Handle of the parent window, if any. The SetParent function changes the parent window of a child window. An application should not call the SetWindowLong function to change the parent of a child window.
GWL_ID  
  Control ID of the child window.
GWL_USERDATA  
  This index can be used to access a LONG that is reserved in every window structure. This LONG is reserved specifically for applications. In general an application should not store values in this LONG if the associated window was created by some other application.

Return Value

The return value specifies information about the given window.

Comments

To access any extra four-byte values allocated when the window-class structure was created, use a positive byte offset as the index specified by the nIndex parameter, starting at zero for the first four-byte value in the extra space, 4 for the next four-byte value and so on.

See Also

SetParent, SetWindowLong, GetWindowWord, SetWindowWord