Jump to content

WinGetMinPosition

From EDM2
Revision as of 17:24, 9 April 2025 by Martini (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This function returns the position to which a window is minimized.

Syntax

 WinGetMinPosition(hwnd, pswp, pptl)

Parameters

hwnd (HWND) - Input
Frame-window handle.
pswp (PSWP) - Output
Set window position structure.
The SWP_SIZE and SWP_MOVE indicators are set in this parameter on return from this function, implying that the parameters have been initialized.
pptl (PPOINTL) - Input
Preferred position.
NULL
System is to choose the position
Other
System is to choose the position nearest to the specified point.

Returns

rc (BOOL) - returns
Success indicator.
TRUE
Successful completion.
The WS_MINIMIZE style is set for hwnd. This enables the system to determine which other frame windows are minimized, during the enumeration process performed by this function. Also, the window words QWS_XMINIMIZE and QWS_YMINIMIZE for hwnd are initialized. This enables the system to ensure that no windows that have been, or are being, minimized use the same position.
FALSE
Error occurred.

Remarks

This function chooses the position for a minimized window. It enumerates all the siblings of the specified window to determine the first available position.

Example Code

#define INCL_WINFRAMEMGR /* Or use INCL_WIN, INCL_PM, */
#include <os2.h>

HWND       hwnd;     /*  Frame-window handle. */
PSWP       pswp;     /*  Set window position structure. */
PPOINTL    pptl;     /*  Preferred position. */
BOOL       rc;      /*  Success indicator. */

rc = WinGetMinPosition(hwnd, pswp, pptl);

This example uses WinGetMinPosition to determine the minimized position for the window in response to a minimize message (WM_MINMAXFRAME), and then calls WinSetWindowPos to minimize the window to that position.

#define INCL_WINFRAMEMGR        /* Window Frame Functions       */
#include <os2.h>

BOOL  fSuccess;         /* Success indicator                    */
HWND  hwnd;             /* window handle                        */
MPARAM  mpParam1;       /* Parameter 1 (window position)        */
PSWP   pSwp;            /* Set window position structure        */

case WM_MINMAXFRAME:
     pSwp = (PSWP)PVOIDFROMMP(mpParam1);

     switch(pSwp->fl)
        {
        case SWP_MINIMIZE:
             fSuccess = WinGetMinPosition(hwnd, pSwp, NULL);

             WinSetWindowPos(hwnd, 0L,
                 pSwp->x,             /* x pos  */
                 pSwp->y,             /* y pos  */
                 pSwp->cx,            /* x size */
                 pSwp->cy,            /* y size */
                 SWP_MINIMIZE);       /* flags */
             break;
        }

Related Functions