Jump to content

WinSetRect: Difference between revisions

From EDM2
Created page with "This function ''sets rectangle coordinates''. ==Syntax== WinSetRect(hab, prclrect, lLeft, lBottom, lRight, lTop) ==Parameters== ;hab (HAB) - Input : Anchor-block handle. ;prclrect (PRECTL) - In/Out : Rectangle to be updated. :;Note :: The value of each field in this structure must be in the range -32 768 through 32 767. The data type WRECT may also be used, if supported by the language. ;lLeft (LONG) - Input : Left edge of rectangle. ;lBottom (LONG..."
 
 
Line 75: Line 75:
* [[WinOffsetRect]]
* [[WinOffsetRect]]
* [[WinPtInRect]]
* [[WinPtInRect]]
* [[WinSetRect]]
* [[WinSetRectEmpty]]
* [[WinSetRectEmpty]]
* [[WinSubtractRect]]
* [[WinSubtractRect]]

Latest revision as of 03:14, 9 April 2025

This function sets rectangle coordinates.

Syntax

WinSetRect(hab, prclrect, lLeft, lBottom, lRight, lTop)

Parameters

hab (HAB) - Input
Anchor-block handle.
prclrect (PRECTL) - In/Out
Rectangle to be updated.
Note
The value of each field in this structure must be in the range -32 768 through 32 767. The data type WRECT may also be used, if supported by the language.
lLeft (LONG) - Input
Left edge of rectangle.
lBottom (LONG) - Input
Bottom edge of rectangle.
lRight (LONG) - Input
Right edge of rectangle.
lTop (LONG) - Input
Top edge of rectangle.

Returns

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

Remarks

This function is equivalent to assigning the left, top, right, and bottom arguments to the appropriate fields of RECTL.

Errors

Possible returns from WinGetLastError: (No specific errors were listed in the provided text.)

Example Code

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

HAB     hab;       /*  Anchor-block handle. */
PRECTL  prclrect;  /*  Rectangle to be updated. */
LONG    lLeft;     /*  Left edge of rectangle. */
LONG    lBottom;   /*  Bottom edge of rectangle. */
LONG    lRight;    /*  Right edge of rectangle. */
LONG    lTop;      /*  Top edge of rectangle. */
BOOL    rc;        /*  Success indicator. */

rc = WinSetRect(hab, prclrect, lLeft, lBottom, lRight, lTop);

This example calls WinQueryWindowRect to get the dimensions of the window, and then calls WinSetRect to downsize it.

#define INCL_WINRECTANGLES
#include <OS2.H>
HAB hab;
RECTL rcl;
HWND hwnd;

 WinQueryWindowRect(hwnd, &rcl);       /* get window dimensions */
 WinSetRect(hab,&rcl,
            rcl.xLeft - 10,
            rcl.yBottom -10,
            rcl.xRight - 10,
            rcl.yTop - 10);

Related Functions