Microsoft KB Archive/10841

From BetaArchive Wiki

HOWTO: Use Extra Fields in Window Class Structure

Q10841



The information in this article applies to:


  • Microsoft Win32 Software Development Kit (SDK)
  • Microsoft Windows Software Development Kit (SDK) versions 3.0, 3.1





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 : kbOSWinNT kbOSWin2000 kbSDKWin32 kbGrpDSUser kbOSWin kbWndw kbWndwClass kbWndwProp
Issue type : kbhowto
Technology : kbWin32SDKSearch kbAudDeveloper kbWin3xSearch kbSDKSearch kbWin32sSearch kbWinSDKSearch kbWinSDK300 kbWinSDK310


Last Reviewed: July 5, 2000
© 2001 Microsoft Corporation. All rights reserved. Terms of Use.