This example uses the recommended size, position and status from the WinQueryTaskSize function to position the first window of a newly-started application (typically the main window).

#define INCL_WINSWITCHLIST
#define INCL_WINFRAMEMGR
#include <OS2.H>

HAB  hab;
SWP  winpos;
HWND hwndFrame;

WinQueryTaskSizePos(hab,
                    0,
                    &winpos);

 WinSetWindowPos(hwndFrame, HWND_TOP,
     winpos.x,                                       /* x pos */
     winpos.y,                                       /* y pos */
     winpos.cx,                                      /* x size */
     winpos.cy,                                      /* y size */
     SWP_ACTIVATE | SWP_MOVE | SWP_SIZE | SWP_SHOW); /* flags*/


[Back] [Next]