Jump to content

WinSetWindowBits

From EDM2

This function sets a number of bits into the memory of the reserved window words.

Syntax

WinSetWindowBits(hwnd, index, flData, flMask)

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 - 4), where cbWindowData is the parameter in WinRegisterClass that specifies the number of bytes available for application-defined storage. Any of the following QWL_* values can be specified:
QWL_HMQ Handle of message queue of window. Note that the leading 16 bits of this value are zero.
QWL_STYLE Window style.
QWL_HWNDFOCUSSAVE Window handle of the child windows of this window that last possessed the focus when this frame window was last deactivated.
QWL_USER A ULONG value for applications to use is present at offset QWL_USER in windows of the following preregistered window classes:
WC_FRAME (includes dialog windows)
WC_COMBOBOX
WC_BUTTON
WC_MENU
WC_STATIC
WC_ENTRYFIELD
WC_LISTBOX
WC_SCROLLBAR
WC_TITTLEBAR
WC_MLE
WC_SPINBUTTON
WC_CONTAINER
WC_SLIDER
WC_VALUESET
WC_NOTEBOOK
This value can be used to place application-specific data in controls.
QWL_DEFBUTTON The default push button for a dialog. The default push button is the one that sends its WM_COMMAND message when the enter key is pressed.
QWL_PENDATA Reserved for use by operating system extensions. It allows an operating system extension to store data on a per window basis.
Other Zero-based index.
flData (ULONG) - Input
Bit data to store in the window words. This is done under the control of the flMask parameter.
flMask (ULONG) - Input
Bits to be written indicator. A "1" bit indicates that the corresponding bit of the flData parameter is to be stored into the window word. A "0" bit indicates that the corresponding bit of the flData parameter is to be ignored in the storing operation; the value of that bit position in the window word is unaltered.

Returns

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

Remarks

The bits are set in a single operation.

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. */
ULONG  flData; /*  Bit data to store in the window words. */
ULONG  flMask; /*  Bits to be written indicator. */
BOOL   rc;     /*  Success indicator. */

rc = WinSetWindowBits(hwnd, index, flData,
       flMask);

This example uses the WinSetWindowBits call to change the attributes of a list box so that only one item can be be selected. This is done by turning off the multiple-select bit.

#define INCL_WINSYS
#include <OS2.H>
HWND  hwndMessageLB;
WinSetWindowBits(hwndMessageLB,
                QWL_STYLE,      /* change style bit. */
                0L,             /* set to 0.          */
                LS_MULTIPLESEL); /* multiple select bit.  */

Related Functions