The information in this article applies to:
SUMMARY
A Windows-based application can extend the behavior of a standard Windows
control by using the technique of superclassing. An application can
superclass a standard Windows control by retrieving its window class
information, modifying the fields of the WNDCLASS structure, and
registering a new class. For example, to associate status information with
each button control in an application, the buttons can be superclassed to
provide a number of window extra bytes.
MORE INFORMATIONThe following five steps are necessary to register a new class that uses some information from the standard windows "button" class:
Any new class created in this manner MUST have a unique class name. Typically, this name would be similar but not identical to the original class. For example, to superclass a button, an appropriate class name might be "superbutton." There is no conflict with class names used by other applications as long as the CS_GLOBALCLASS class style is not specified. The standard Windows "button" class remains unchanged and can still be used by the application as normal. In addition, once a new class has been registered, any number of controls can be created and destroyed with no extra coding effort. The superclass is simply another class in the pool of classes that can be used when creating a window. The sample code below demonstrates this procedure:
It is important to note that the lpszClassName, lpszMenuName, and hInstance
fields in the WNDCLASS structure are NOT returned by the GetClassInfo()
function. Please refer to page 4-153 of the "Microsoft Windows Software
Development Kit Reference Volume 1" for more information. Also, each time a
new class is registered, scarce system resources are used. If it is
necessary to alter many different standard classes, the GetProp(),
SetProp(), and RemoveProp() functions should be used as an alternative
approach to associating extra information with standard Windows controls.
Additional query words:
Keywords : kbWinOS2000 kbSDKWin32 kbGrpUser kbWndw kbWndwClass |
Last Reviewed: January 27, 2000 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |