HOWTO: Use Extra Fields in Window Class Structure (10841)
The information in this article applies to:
- Microsoft Platform Software Development Kit (SDK) 1.0
- Microsoft Windows Software Development Kit (SDK) 3.0
- Microsoft Windows Software Development Kit (SDK) 3.1
This article was previously published under Q10841 SUMMARY
To generate several child windows of the same class, each having
its own set of static variables and independent of the sets of the
variables in the sibling windows, you need to use the cbWndExtra field in
WNDCLASS, the window-class data structure, when registering a window; then,
use SetWindowWord() (or Long) and GetWindowWord() (or Long). These
functions will either get or set additional information about the window
identified by hWnd.
Use positive offsets as indexes to access any additional bytes that were
allocated when the window class structure was created, starting at zero for
the first byte of the extra space. Similarly, if you want to refer to bytes
already defined by Windows within the structure, use offsets defined with
the GWW and GWL prefixes.
For compatibility with future operating sustems, you should use the SetWindowLongPtr() and GetWindowLongPtr() functions to set and retrieve the window extra bytes.
Modification Type: | Minor | Last Reviewed: | 7/11/2005 |
---|
Keywords: | kbhowto kbWndw kbWndwClass kbWndwProp KB10841 |
---|
|