GetWindow

2.x

  HWND GetWindow(hwnd, fuRel)    
  HWND hwnd; /* handle of original window */
  UINT fuRel; /* relationship flag, */  

The GetWindow function retrieves the handle of a window that has the specified relationship to the given window. The function searches the system's list of top-level windows, their associated child windows, the child windows of any child windows, and any siblings of the owner of a window.

Parameters

hwnd

Identifies the original window.

fuRel

Specifies the relationship between the original window and the returned window. This parameter can be one of the following values:

Value Meaning

GW_CHILD Identifies the window's first child window.
GW_HWNDFIRST Returns the first sibling window for a child window; otherwise, it returns the first top-level window in the list.
GW_HWNDLAST Returns the last sibling window for a child window; otherwise, it returns the last top-level window in the list.
GW_HWNDNEXT Returns the sibling window that follows the given window in the list.
GW_HWNDPREV Returns the previous sibling window in the list.
GW_OWNER Identifies the window's owner.

Return Value

The return value is the handle of the window if the function is successful. Otherwise, it is NULL, indicating either the end of the system's list or an invalid fuRel parameter.

See Also

EnumWindows, FindWindow