Using SetClassLong Function to Subclass a Window ClassLast reviewed: November 2, 1995Article ID: Q32519 |
The information in this article applies to:
SUMMARYIt 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.
MORE INFORMATIONCalling 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: listbox scrollbar 3.00 3.10 3.50 4.00 95
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |