HOWTO: Use SetClassLong Function to Subclass a Window ClassID: Q32519
|
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.
NOTE: In Win32, SetClassLong() only affects Windows in the same address
space. For example, if you subclass EDIT, only edit controls created in
your application will be subclassed.
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 query words: listbox scrollbar
Keywords : kbNTOS kbGrpUser kbWinOS kbWndw kbWndwClass kbWndwProc
Version :
Platform :
Issue type : kbhowto
Last Reviewed: March 5, 1999