Knowledge Base |

# HOWTO: Use Extra Fields in Window Class Structure

Article ID: 10841

Article Last Modified on 7/11/2005

APPLIES TO

- Microsoft Platform Software Development Kit-January 2000 Edition
- Microsoft Windows Software Development Kit 3.0
- Microsoft Windows Software Development Kit 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.

Additional query words: win16sdk

Keywords: kbhowto kbwndwprop kbwndw kbwndwclass KB10841