Jump to content

WinSetWindowUShort

From EDM2
Revision as of 18:46, 9 April 2025 by Martini (talk | contribs) (Created page with "This function sets an unsigned, short integer value into the memory of the reserved window words. ==Syntax== WinSetWindowUShort(hwnd, index, us) ==Parameters== ;hwnd (HWND) - Input : Window handle. ;index (LONG) - Input : Zero-based index of the value to be set. : The units of ''index'' are bytes. Valid values are zero through (''cbWindowData'' - 2), where ''cbWindowData'' is the parameter in WinRegisterClass that specifies the number of bytes available fo...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This function sets an unsigned, short integer value into the memory of the reserved window words.

Syntax

WinSetWindowUShort(hwnd, index, us)

Parameters

hwnd (HWND) - Input
Window handle.
index (LONG) - Input
Zero-based index of the value to be set.
The units of index are bytes. Valid values are zero through (cbWindowData - 2), where cbWindowData is the parameter in WinRegisterClass that specifies the number of bytes available for application-defined storage. Any of the following QWS__* values are also valid.
Note
QWL_* values cannot be used.
QWS_CXRESTORE The width to which the window is restored. See also the QWS_CYRESTORE value.
QWS_CYRESTORE The height to which the window is restored. These values are only valid while the window is maximized or minimized (that is, while either the WS_MINIMIZED or WS_MAXIMIZED window style indicators are set). Changing these values with the WinSetWindowUShort call alters the restore size and position.
QWS_FLAGS These indicators apply only to frame or dialog windows, and contain combinations of the following indicators:
FF_ACTIVE Frame window is displayed in the active state.
FF_DIALOGBOX Frame window is being used as a dialog box.
FF_DLGDISMISSED Dialog has been dismissed by the WinDismissDlg function.
FF_FLASHHILITE Window is currently flashed. This indicator toggles with each flash.
FF_FLASHWINDOW Frame window is flashing.
FF_OWNERDISABLED Window's owner is disabled. This indicator is only set if the window and its owner are siblings.
FF_OWNERHIDDEN Frame window is hidden as a result of its owner being hidden or minimized. This indicator is set only if the window and its owner are siblings.
FF_SELECTED Frame window is selected.
QWS_ID Window identity. The value of the id parameter of the WinCreateWindow function.
QWS_RESULT Dialog-result parameter, as established by the WinDismissDlg function.
QWS_XMINIMIZE The x-coordinate of the position to which the window is minimized. If this value is -1, the window has not been minimized. See also the QWS_YMINIMIZE value.
QWS_XRESTORE The x-coordinate of the position to which the window is restored. See also the QWS_CYRESTORE value.
QWS_YMINIMIZE The y-coordinate of the position to which the window is minimized. When the window is minimized for the first time an arbitrary position is chosen. Changing these values with the WinSetWindowUShort call alters the position of the minimized window, but only when the window is not in a minimized state.
QWS_YRESTORE The y-coordinate of the position to which the window is restored. See also the QWS_CYRESTORE value.
Other Zero-based index.
us (USHORT) - Input
Unsigned, short integer value to store in the window words.

Returns

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

Example Code

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

HWND      hwnd;     /*  Window handle. */
LONG      index;    /*  Zero-based index of the value to be set. */
USHORT    us;      /*  Unsigned, short integer value to store in the window words. */
BOOL      rc;      /*  Success indicator. */

rc = WinSetWindowUShort(hwnd, index, us);

This example changes the height to which a window is restored to 100 by changing the value of a system defined window word.

#define INCL_WINWINDOWMGR
#include <OS2.H>

HWND hwnd;

/* The height to which the window is restored */
WinSetWindowUShort(hwnd,
                  QWS_CYRESTORE,
                  (USHORT)100);

Related Functions