WinQueryWindowULong
Appearance
This function obtains the unsigned long integer value, at a specified offset, from the memory of a reserved window word, of a given window.
Syntax
WinQueryWindowULong(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 - 4), where cbWindowData is the parameter in WinRegisterClass that specifies the number of bytes available for application-defined storage. Any of the QWL_* values are valid.
- Note: QWS_* values cannot be used.
- 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_HMQ: Handle of message queue of window. Note that the leading 16 bits of this value are zero.
- QWL_HWNDFOCUSSAVE: Window handle of the child windows of this window that last possessed the focus when this frame window was last deactivated.
- QWL_PENDATA: Reserved for use by operating system extensions. It allows an operating system extension to store data on a per window basis.
- QWL_STYLE: Window style.
- QWL_USER: A ULONG value for applications to use is present at offset QWL_USER in windows of the following preregistered window classes: WC_BUTTON, WC_COMBOBOX, WC_CONTAINER, WC_ENTRYFIELD, WC_FRAME (includes dialog windows), WC_LISTBOX, WC_MENU, WC_MLE, WC_NOTEBOOK, WC_SCROLLBAR, WC_SLIDER, WC_SPINBUTTON, WC_STATIC, WC_TITLEBAR, WC_VALUESET. This value can be used to place application-specific data in controls.
- Other: Zero-based index.
Returns
- ulValue (ULONG) - returns
- Value contained in the window word.
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.
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.
The specified index is valid only if all of the bytes referenced are within the reserved memory.
Example Code
Declaration:
#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. */ ULONG ulValue; /* Value contained in the window word. */ ulValue = WinQueryWindowULong(hwnd, index);
This example shows how to get the handle of the message queue of a window.
#define INCL_WINWINDOWMGR #include <os2.h> HWND hwnd; HMQ hmq; hmq = (HMQ)WinQueryWindowULong(hwnd, QWL_HMQ);