Subclassing controls 
Author Message
 Subclassing controls

I'm replying to my own message because I got it.

BEGIN_MESSAGE_MAP( theClass, baseClass )

enuf said

Tue, 18 Jan 2000 03:00:00 GMT  
 Subclassing controls

VC++5.0 WinNT 4.0(3)

I have this class, derived from CWnd:

class CIndicator : public CWnd


I have another class derived from CIndicator:

class CController : public CIndicator


These are both "controls" to be placed on a dialog (or any other window).
CController is supposed to look like a CIndicator, but has control

The way I'm implementing it now is to register two Win32 classes
"indicator" and "controller" and placing them in the dialog as custom
controls.  The dialog class has static member variables for CIndicator
objects and CController objects.  During OnInitDialog() I then subclass the


The problem is that messages don't get passed up from CController if they
are not handled by CController.  I've looked at the ctrltest sample
application and they do something similiar.  The difference is that the
'parent' class for them is the windows common edit control and so unhandled
messages get pumped to the stock edit control, where in my case unhandled
messages get pumped to the WNDPROC function I specified when I registered
the classes.

Ok, so I tried setting the m_pfnSuper member of CWnd (like they do in
ctrltest).  The problem is that all MFC CCmdTarget derived objects use the
same WNDPROC (AfxWndProc) and I get a stack overflow as appearently this
causes recursion in the code.

How do I get my base class to handle messages that are not handled by

(I hope this question was clearly stated, It's a complex problem - what
with the bizarre way MFC tried to make Window's 'look' like C++)

Tue, 18 Jan 2000 03:00:00 GMT  
 Subclassing controls

At least you took the time to look at the examples and
read through your own code.  I wish I could say that about
everybody.  Seems like most people want everything for
free these days.

Robert W. Largent
Direct Data Applications

> I'm replying to my own message because I got it.

> BEGIN_MESSAGE_MAP( theClass, baseClass )

> enuf said

Wed, 19 Jan 2000 03:00:00 GMT  
 [ 3 post ] 

 Relevant Pages 

1. Subclassing controls

2. Subclassing controls

3. subclassing controls in dynamically biult dialog box

4. subclassing controls in CFormView

5. Subclassing Controls

6. subclassing controls w/ ActiveX

7. Subclassing Control (pref. RichEdit)

8. Subclassing controls

9. Subclassing controls in a composite control within the container class.

10. Subclassing the header control inside list control

11. Help:ACIVEX controls- subclassing Windows Control

12. Subclassing an ActiveX control


Powered by phpBB® Forum Software