win12.hlp (Table of Contents; Topic list)
WinSubclassWindow (1.2)
Function Group  Overview                          Up Next Previous
────────────────────────────────────────────────────────────────────────────
 
#define INCL_WINWINDOWMGR
 
PFNWP WinSubclassWindow(hwnd, pfnwp)
HWND hwnd;      /* handle of the window to subclass */
PFNWP pfnwp;    /* address of new window procedure  */
 
The WinSubclassWindow function subclasses a window by replacing its window
procedure with another window procedure specified by the pfnwp parameter.
 
Parameter  Description
────────────────────────────────────────────────────────────────────────────
 
hwnd       Identifies the window to subclass.
 
pfnwp      Points to the address of the window procedure used to subclass
           the window.
 
Return Value
 
The return value, if the function is successful, is the address of the
previous window procedure that belongs to the window specified by the hwnd
parameter. Otherwise, the return value is 0L.
 
Comments
 
To subclass a window effectively, the new window procedure should call the
old window procedure, rather than the WinDefWindowProc function, for those
messages it does not process itself.
 
To reverse the effect of subclassing, call WinSubclassWindow again using the
old window procedure address.
 
It is not possible to subclass a window created by another process.
 
See Also
 
WinDefWindowProc