This example uses the WinSetMultWindowPos to cascade up to 16 main windows.

#define INCL_WINWINDOWMGR
#include <OS2.H>

HWND ahwnd[16];   /* Array of window handles */
SWP  aSwp[16];    /* Array of SWP structures */
SWP  swp;
HAB  hab;
LONG xcoord, ycoord;
LONG i=1;

/* Get the recommended window position */
WinQueryTaskSizePos(hab,
                    0,
                    &swp);

xcoord = swp.x;
ycoord = swp.y;

/* Initialize the array of SWP structures */
/* where each is displaced by (10,10)     */
for (i=0; i<16 ; i++ )
{
  aSwp[i] = swp;
  aSwp[i].x = xcoord;
  aSwp[i].y = ycoord;
  xcoord += 10;
  ycoord += 10;
} /* endfor */

/* Get a list of all the main windows into the ahwnd array */
i=0
henum = WinBeginEnumWindows(HWND_DESKTOP);
do
{
  ahwnd[i] = WinGetNextWindow(henum);
}
while((ahwnd[i++]! = NULL) && i < 16);
WinEndEnumWindows(henum);
WinSetMultWindowPos(hab,aSwp,i-1);


[Back] [Next]