Naughter Software Logo

CHookWnd LogoCHookWnd v1.08 An MFC class to support MFC subclassing (Obsolete)

Welcome to CHookWnd, an MFC class to support sub-classing of any CWnd instance. The problem it fixes is that you cannot have 2 CWnd instances attached to the one HWND at the same time. This becomes a problem when you want to derive one of your classes from 2 base classes which are both derived from CWnd themselves. An example is, suppose you have 2 classes namely CBitmapMenuFrameWnd which is derived from CFrameWnd and implements bitmap menus ALA Office 97 and CReBarFrameWnd which implements command bar menus ALA IE4. When you are implementing your own CMainFrame class you then have the problem that you can only derive from one of these classes and you must copy the source from the other one into your class. 

This class fixes this problem by subclassing the window before MFC gets to it using a plugin method. The code is based in part on a class developed by Paul DiLascia namely "CSubclassWnd" for the MSJ magazine.


The enclosed zip file contains the CHookWnd source code and a simple SDI MFC application which demonstrates all the functionality of the class. For further details about the example program have a look at the view.cpp module.





V1.0 (25 February 1999)

V1.01 (29 March 1999)

V1.02 (10 May 1999)

V1.03 (21 March 2003)

V1.04 (29 March 2003)

V1.05 (31 March 2003)

V1.06 (2 April 2003)

V1.07 (17 April 2003)

V1.08 (1 November 2004)

27 June 2006