Jump to content

WinGetMaxPosition: Difference between revisions

From EDM2
Created page with "The WinGetMaxPosition function fills an SWP structure with the maximized-window size and position. ==Syntax==  WinGetMaxPosition(hwnd, pswp) ==Parameters== ;hwnd (HWND) - Input : Frame-window handle. : Identifies the window whose maximum size will be retrieved. ;pswp (PSWP) - Output : Set window position structure. : Points to the SWP structure that retrieves the size and position of a maximized window. : The SWP_SIZE and SWP_MOVE indicators are set in this pa..."
 
No edit summary
 
Line 8: Line 8:
: Frame-window handle.
: Frame-window handle.
: Identifies the window whose maximum size will be retrieved.
: Identifies the window whose maximum size will be retrieved.
;pswp ([[PSWP]]) - Output
;pswp (P[[SWP]]) - Output
: Set window position structure.
: Set window position structure.
: Points to the SWP structure that retrieves the size and position of a maximized window.
: Points to the SWP structure that retrieves the size and position of a maximized window.

Latest revision as of 22:54, 9 April 2025

The WinGetMaxPosition function fills an SWP structure with the maximized-window size and position.

Syntax

 WinGetMaxPosition(hwnd, pswp)

Parameters

hwnd (HWND) - Input
Frame-window handle.
Identifies the window whose maximum size will be retrieved.
pswp (PSWP) - Output
Set window position structure.
Points to the SWP structure that retrieves the size and position of a maximized window.
The SWP_SIZE and SWP_MOVE indicators are set in this parameter on return from this call, implying that the parameters have been initialized.

Returns

fSuccess (BOOL) - returns
Success indicator.
TRUE
Successful completion.
FALSE
Error occurred.

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. */
BOOL    fSuccess;  /*  Success indicator. */

fSuccess = WinGetMaxPosition(hwnd, pswp);

This example uses WinGetMaxPosition to determine the maximized position for the window in response to a maximize message (WM_MINMAXFRAME), and then calls WinSetWindowPos to maximize 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_MAXIMIZE:
             fSuccess = WinGetMaxPosition(hwnd, pSwp);

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