GetWindow

Syntax

HWND GetWindow(hWnd,wCmd)

This function searches for a handle to a window from the window manager's list. The window-manager's list contains entries for all top-level windows, their associated child windows, and the child windows of any child windows. The wCmd parameter specifies the relationship between the window identified by the hWnd parameter and the window whose handle is returned.

Parameter Type/Description  

hWnd HWND Identifies the original window.  
wCmd WORD Specifies the relationship between the original window and the returned window. It may 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 window that follows the given window on the window manager's list.
  GW_HWNDPREV Returns the previous window on the window manager's list.
  GW_OWNER Identifies the window's owner.

Return Value

The return value identifies a window. It is NULL if it reaches the end of the window manager's list or if the wCmd parameter is invalid.