WinSetMultWindowPos
This function performs the WinSetWindowPos function for cswp windows, using pswp, an array of structures whose elements correspond to the input parameters of WinSetWindowPos.
Syntax
WinSetMultWindowPos(hab, pswp, cswp)
Parameters
- hab (HAB) - Input
- Anchor-block handle.
- pswp (PSWP) - Input
- An array of set window position (SWP) structures.
- The elements of each correspond to the input parameters of WinSetWindowPos.
- cswp (ULONG) - Input
- Window count.
- This parameter can be set to 0, representing an empty list of SWP structures.
Returns
- rc (BOOL) - returns
- Positioning success indicator.
- TRUE
- Positioning succeeded
- FALSE
- Positioning failed.
Remarks
All windows being positioned must have the same parent. It is more efficient to use this function than to issue multiple WinSetWindowPos functions, as it causes less screen updating. If specifies a frame window, this function recalculates the sizes and positions of the frame controls. If the new window rectangle for any frame control is to be empty, instead of resizing or repositioning that control, it is hidden by (SWP_HIDE) instead. This eliminates needless processing of windows that are not visible. The window rectangle of the control in question is left in its original state. For example, if WinSetWindowPos is issued to change the size of a standard frame window to an empty rectangle, and WinQueryWindowRect is issued against the client window, the rectangle returned is not an empty rectangle, but the original client rectangle before WinSetWindowPos was issued.
Errors
Possible returns from WinGetLastError:
- PMERR_INVALID_HWND (0x1001)
- An invalid window handle was specified.
- PMERR_INVALID_FLAG (0x1019)
- An invalid bit was set for a parameter. Use constants defined by PM for options, and do not set any reserved bits.
Example Code
#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; HENUM henum; /* 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++]!= NULLHANDLE) && (i < 16)); WinEndEnumWindows(henum); WinSetMultWindowPos(hab,aSwp,i-1);