INF: Using SetClassLong Function to Subclass a Window Class

ID Number: Q32519

2.03 2.10 3.00 3.10

WINDOWS

Summary:

It is possible to subclass an entire window class by using the

SetClassLong function. However, doing so will only subclass windows

of that class created after the call to the SetClassLong function.

Windows created before the call to the SetClassLong function are not

affected.

More Information:

Calling the SetClassLong function with the GCL_WNDPROC index changes

the class function address for that window class, creating a subclass

of the window class. When a subsequent window of that class is created,

the new class function address is inserted into its window structure,

subclassing the new window. Windows created before the call to the

SetClassLong function (in other words, before the class function

address was changed) are not subclassed.

An application should not use the SetClassLong function to subclass

standard Windows controls such as edit controls or buttons. If, for

example, an application were to subclass the entire "edit" class,

then subsequent edit controls created by other applications would be

subclassed.

An application can subclass individual standard Windows controls that

it has created by calling the SetWindowLong function.

Additional reference words: edit static button listbox scrollbar 2.03

2.10 2.x 3.00 3.10