These are techniques that can augment or extend the properties of windows, whether they are based on existing, default window classes, such as controls like buttons and comboboxes, or on user-defined windows. The terms subclassing and superclassing are not used in the context of C++ but do have an object orientated connotation.
Subclassing
This is a process where the existing window procedure for an already created window is replaced by another, user-defined window procedure. The CallWindowProc api function can be used to get message handling behaviour from the original window procedure, if required.
There are two approaches to window subclassing. The first is usable by most windows operating systems (win9x,win2k,winxp and later), the second is only usable with a minimum operating system of winxp since it relies on ComCtl32.dll version 6, in particular three api functions exported by this library, namely DefSubclassProc, RemoveWindowSubclass and SetWindowSubclass. In the first, universally applicable approach, the new window procedure is set using SetWindowLongPtr and retrieved with the corresponding GetWindowLongPtr. While this method will work on most Windows operating systems, it suffers from the obvious flaw that others might subclass your subclassed window (or you might subclass theirs) with possibly disastrous consequences, particularly if one of the subclasses allocates memory but, due to later subclassing, is unable to free it giving rise to a memory leak. The second approach, while it addresses many of these management issues, is obviously limited to later operating systems.
A third, possible approach to window subclassing might be to use hooks. Using this approach, management of chains of subclasses becomes irrelevant as does the issue of limitation to specific families of operating systems.
Superclassing
This approach bases a new, unique window class off of an existing window class. The original window class's details are copied into a WNDCLASSEX structure using GetClassInfoEx and those parameters of the filled WNDCLASSEX structure that need to be modified, such as, for example, the window procedure and application instance, are changed as required. This modified WNDCLASSEX stucture is used with RegisterClassEx prior to creating windows of this new, unique registered window class.