WinMultWindowFromIDs
Appearance
This function finds the handles of child windows that belong to a specified window and have window identities within a specified range.
Syntax
WinMultWindowFromIDs(hwndParent, prghwnd, idFirst, idLast)
Parameters
- hwndParent (HWND) - Input
- Parent-window handle.
- prghwnd (PHWND) - Output
- Window handles.
- Array of window handles. The array must contain (idLast - idFirst + 1) elements. The handle of a window, whose identity is WID (in the range idFirst to idLast), has a zero-based index in the array of (WID - idFirst). If there is no window for a window identity within the range, the corresponding element in the array is NULLHANDLE.
- idFirst (ULONG) - Input
- First window identity value in the range (inclusive).
- It must be greater than or equal to 0 and less than or equal to 0xFFFF.
- idLast (ULONG) - Input
- Last window identity value in the range (inclusive).
- It must be greater than or equal to 0 and less than or equal to 0xFFFF.
Returns
- lWindows (LONG) - Returns
- Number of window handles returned.
- 0
- No window handles returned.
- Other
- Number of window handles returned.
Remarks
This function can be used to enumerate all the items in a dialog group, or to enumerate all the frame controls of a standard window. This function is faster than individual calls to the WinWindowFromID function.
Errors
Possible returns from WinGetLastError:
- PMERR_INVALID_HWND (0x1001)
- An invalid window handle was specified.
Example Code
#define INCL_WINWINDOWMGR /* Or use INCL_WIN, INCL_PM, */ #include <os2.h> HWND hwndParent; /* Parent-window handle. */ PHWND prghwnd; /* Window handles. */ ULONG idFirst; /* First window identity value in the range (inclusive). */ ULONG idLast; /* Last window identity value in the range (inclusive). */ LONG lWindows; /* Number of window handles returned. */ lWindows = WinMultWindowFromIDs(hwndParent, prghwnd, idFirst, idLast);
This example finds the handles of all frame controls of a specified window via the WinMultWindowFromIDs call. The handles are returned in an array of window handles, and after the call completes, the handle for the minmax control window is assigned to a variable if a handle for it was found (i.e., handle not equal to NULLHANDLE).
#define INCL_WINWINDOWMGR /* Window Manager Functions */ #define INCL_WINFRAMEMGR /* Window Frame Functions */ #include <os2.h> HWND hwndParent; /* parent window */ HWND ahwnd[FID_CLIENT-FID_SYSMENU]; /* window handle array */ HWND hwndMinMax; /* minmax control window handle */ LONG lHandles; /* number of handles returned */ /* get all control handles between and including system menu and client windows */ lHandles = WinMultWindowFromIDs(hwndParent, ahwnd, FID_SYSMENU, FID_CLIENT); /* if any handles returned and the handle for the minmax control is not null, assign a variable to the minmax handle */ if (lHandles > 0 && ahwnd[FID_MINMAX - FID_SYSMENU] != NULLHANDLE) hwndMinMax = ahwnd[FID_MINMAX - FID_SYSMENU];