| UID | NF:winuser.GetNextWindow | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| title | GetNextWindow macro (winuser.h) | |||||||||
| description | 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. | |||||||||
| helpviewer_keywords |
|
|||||||||
| old-location | winmsg\getnextwindow.htm | |||||||||
| tech.root | winmsg | |||||||||
| ms.assetid | VS|winui|~\winui\windowsuserinterface\windowing\windows\windowreference\windowfunctions\getnextwindow.htm | |||||||||
| ms.date | 09/02/2025 | |||||||||
| ms.keywords | GW_HWNDNEXT, GW_HWNDPREV, GetNextWindow, GetNextWindow function [Windows and Messages], _win32_GetNextWindow, _win32_getnextwindow_cpp, winmsg.getnextwindow, winui._win32_getnextwindow, winuser/GetNextWindow | |||||||||
| req.header | winuser.h | |||||||||
| req.include-header | Windows.h | |||||||||
| req.target-type | Windows | |||||||||
| req.target-min-winverclnt | Windows 2000 Professional [desktop apps only] | |||||||||
| req.target-min-winversvr | Windows 2000 Server [desktop apps only] | |||||||||
| req.kmdf-ver | ||||||||||
| req.umdf-ver | ||||||||||
| req.ddi-compliance | ||||||||||
| req.unicode-ansi | ||||||||||
| req.idl | ||||||||||
| req.max-support | ||||||||||
| req.namespace | ||||||||||
| req.assembly | ||||||||||
| req.type-library | ||||||||||
| req.lib | ||||||||||
| req.dll | ||||||||||
| req.irql | ||||||||||
| targetos | Windows | |||||||||
| req.typenames | ||||||||||
| req.redist | ||||||||||
| ms.custom | 19H1 | |||||||||
| f1_keywords |
|
|||||||||
| dev_langs |
|
|||||||||
| topic_type |
|
|||||||||
| api_type |
|
|||||||||
| api_location |
|
|||||||||
| api_name |
|
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.
Type: HWND
A handle to a window. The window handle retrieved is relative to this window, based on the value of the wCmd parameter.
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 |
|---|---|
|
Returns a handle to the window below the given window. |
|
Returns a handle to the window above the given window. |
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. The function does not clear the last error information. To determine success or failure in case of NULL return value, clear the last error information by calling SetLastError function with 0 value, then call GetNextWindow. Function failure will be indicated by a return value of NULL and a GetLastError function result that is nonzero.
This function is implemented as a call to the GetWindow function.
#define GetNextWindow(hWnd, wCmd) GetWindow(hWnd, wCmd)HWND GetNextWindow(
[in] hWnd,
[in] wCmd
);Conceptual
Reference