Jump to content

WinEndEnumWindow

From EDM2
Revision as of 17:23, 9 April 2025 by Martini (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This function ends the enumeration process for a specified enumeration.

Syntax

 WinEndEnumWindows(henum)

Parameters

henum (HENUM) - Input
Enumeration handle.
Returned by previous call to the WinBeginEnumWindows call.

Returns

rc (BOOL) - returns
Success indicator.
TRUE
Successful completion
FALSE
Error occurred.

Remarks

This function destroys the window hierarchy remembered by the WinBeginEnumWindows function. After this function, the henum parameter is no longer valid.

Errors

Possible returns from WinGetLastError:

  • PMERR_INVALID_HENUM (0x101C)
An invalid enumeration handle was specified.


Example Code

#define INCL_WINWINDOWMGR /* Or use INCL_WIN, INCL_PM, */
#include <os2.h>

HENUM  henum;  /*  Enumeration handle. */
BOOL  fSuccess;  /*  Success indicator. */

henum = WinBeginEnumWindows(HWND_DESKTOP);
// ... enumeration using WinGetNextWindow ...
fSuccess = WinEndEnumWindows (henum);

This example ends the child window enumeration and releases the enumeration handle supplied by WinBeginEnumWindows after WinGetNextWindow has enumerated all immediate children of the Desktop.

#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) {
   // Process each child window (hwndNext)
}
fSuccess = WinEndEnumWindows (henum);

Related Functions