WinQueryWindowUShort
Appearance
This function obtains the unsigned short integer value at a specified offset from the reserved window word's memory of a given window.
Syntax
WinQueryWindowUShort(hwnd, index)
Parameters
- hwnd (HWND) - Input
- Handle of window to be queried.
- index (LONG) - Input
- Zero-based index into the window words of the value to be queried.
- 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 QWS_* values are 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.
Returns
- usValue (USHORT) - returns
- Value contained in the indicated window word.
Remarks
The window handle that is passed to this function can be the handle of a window with the same, or different, message queue as the caller, thereby allowing the caller to obtain data from windows belonging to other threads.
Errors
Possible returns from WinGetLastError:
- PMERR_INVALID_HWND (0x1001) An invalid window handle was specified.
- PMERR_PARAMETER_OUT_OF_RANGE (0x1003) The value of a parameter was not within the defined valid range for that parameter.
Example Code
#define INCL_WINWINDOWMGR /* Or use INCL_WIN, INCL_PM, */ #include <os2.h> HWND hwnd; /* Handle of window to be queried. */ LONG index; /* Zero-based index into the window words of the value to be queried. */ USHORT usValue; /* Value contained in the indicated window word. */ usValue = WinQueryWindowUShort(hwnd, index);
In this example, the WinQueryWindowUShort call is used to query the window words to see if a window has been minimized.
#define INCL_WINWINDOWMGR #include <OS2.H> HWND hwnd; USHORT usResult; usResult = WinQueryWindowUShort(hwnd, QWS_XMINIMIZE); if (-1 == (LONG)usResult) { /* Window has not been minimized */ }