WinGetNextWindow: Difference between revisions
Appearance
No edit summary |
|||
Line 1: | Line 1: | ||
This function gets the window handle of the next window in a specified enumeration list. | This function gets the window handle of the next window in a specified enumeration list. | ||
==Syntax== | ==Syntax== | ||
WinGetNextWindow(henum) | WinGetNextWindow(henum) | ||
Line 8: | Line 7: | ||
==Returns== | ==Returns== | ||
; hwndNext (HWND) - returns :Next window handle in enumeration list. | ; hwndNext ([[HWND]]) - returns :Next window handle in enumeration list. | ||
:;NULLHANDLE | :;NULLHANDLE | ||
::Error occurred, henum was invalid, or all the windows have been enumerated. | ::Error occurred, henum was invalid, or all the windows have been enumerated. |
Revision as of 04:15, 6 April 2025
This function gets the window handle of the next window in a specified enumeration list.
Syntax
WinGetNextWindow(henum)
Parameters
- henum (HENUM) - input
- Enumeration handle.
- Returned by previous call to the WinBeginEnumWindows call.
Returns
- hwndNext (HWND) - returns
- Next window handle in enumeration list.
- NULLHANDLE
- Error occurred, henum was invalid, or all the windows have been enumerated.
- Other
- Next window handle.
Errors
Possible returns from WinGetLastError
- PMERR_INVALID_HENUM (0x101C)
- An invalid enumeration handle was specified.
Remarks
Enumeration starts with the topmost child window and then proceeds downward through the enumeration list, in z-order at the time the WinBeginEnumWindows was issued, until all the windows have been enumerated. At this point, the call returns NULLHANDLE. The enumeration then wraps and the handle of the topmost child window is returned on the next call. This function does not lock windows.
Example Code
#define INCL_WINWINDOWMGR /* Or use INCL_WIN, INCL_PM, */ #include <os2.h> HENUM henum; /* Enumeration handle. */ HWND hwndNext; /* Next window handle in enumeration list. */ hwndNext = WinGetNextWindow(henum);
This example moves through all the child windows in a enumeration list, using an enumeration handle provided by WinBeginEnumWindows; for each child window, the class name is queried and placed in a buffer.
#define INCL_WINWINDOWMGR /* Window Manager Functions */ #include <os2.h> HWND hwndParent; /* Handle of the window whose child windows are to be enumerated */ HWND hwndNext; /* current enumeration handle */ HENUM henum; /* enumeration handle */ BOOL fSuccess; /* success indicator */ SHORT sRetLen; /* returned string length */ SHORT sLength = 10; /* string buffer length */ char pchBuffer[10]; /* string buffer */ hwndParent = HWND_DESKTOP; henum = WinBeginEnumWindows(hwndParent); while ((hwndNext = WinGetNextWindow(henum)) != NULLHANDLE) sRetLen = WinQueryClassName(hwndNext, sLength, pchBuffer); fSuccess = WinEndEnumWindows (henum);
Related Functions
- WinBeginEnumWindows
- WinEndEnumWindows
- WinEnumDlgItem
- WinIsChild
- WinMultWindowFromIDs
- WinQueryWindow
- WinSetOwner
- WinSetParent