INF: Subclassing Warning in Windows SDK Reference Volume 1

ID Number: Q68584

3.00

WINDOWS

Summary:

Window subclassing is explained on page 1-17 of the "Microsoft Windows

Software Development Kit Reference Volume 1," in the section titled

"Window Subclassing."

At the end of that section, the following warning appears:

Note: An application should not attempt to create a window subclass

for standard Windows controls such as combo boxes and buttons.

This warning means that SetClassLong() should not be used to subclass

an entire standard control class. This would cause all controls of

that type (including controls in other applications) created while the

subclass was in effect to be subclassed.

SetWindowLong() can be used to subclass individual controls in your

application.

In addition, standard Windows controls should only be subclassed in

"non-intrusive" ways. Subclassing procedures that alter the appearance

of a control or that depend on undocumented messages or message

parameters could be incompatible with future versions of Windows.

More Information:

For more information on subclassing controls, query on the following

word:

subclassing

Charles Petzold's "Programming Windows" (Microsoft Press) contains a

sample program that shows how to subclass a standard control (in this

case, a scroll bar). In the Windows 2.x version of the book, the

sample is called COLORSCR; in the Windows 3.00 version, the sample is

called COLORS1.