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);


[Back] [Next]