GetNextWindow macro (winuser.h)

Retrieves a handle to the next or previous window in the Z-Order. The next window is below the specified window; the previous window is above.

If the specified window is a topmost window, the function searches for a topmost window. If the specified window is a top-level window, the function searches for a top-level window. If the specified window is a child window, the function searches for a child window.

Syntax

void GetNextWindow(
  [in]  hWnd,
  [in]  wCmd
);

Parameters

[in] hWnd

Type: HWND

A handle to a window. The window handle retrieved is relative to this window, based on the value of the wCmd parameter.

[in] wCmd

Type: UINT

Indicates whether the function returns a handle to the next window or the previous window. This parameter can be either of the following values.

Value Meaning
GW_HWNDNEXT
2
Returns a handle to the window below the given window.
GW_HWNDPREV
3
Returns a handle to the window above the given window.

Return value

Type: HWND

If the function succeeds, the return value is a window handle. If no window exists with the specified relationship to the specified window, the return value is NULL. To get extended error information, call GetLastError.

Remarks

This function is implemented as a call to the GetWindow function.

#define GetNextWindow(hWnd, wCmd) GetWindow(hWnd, wCmd)

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header winuser.h (include Windows.h)

See also

Conceptual

GetTopWindow

GetWindow

Reference

Windows