Click to See Complete Forum and Search --> : Message maps in derived base classes?


Rob Adelberg
September 22nd, 1999, 05:37 PM
Hi,

What is a derived base class?

I had wanted to create a base PropertyPage class CMyBasePage : CPropertyPage
and then create my own property pages based from that class CMyPage : CMyBasePage

Why?
I have a property sheet with pages that are nearly alike. I already have
them using the same Dialog resource and through a little manipulation,
I already have seperate titles for each page.

Since about 80% of the controls were the same I thought I would create a
base class and and put those controls in the base class, with their own message maps.
And then create a derived class for the differences. The base class has a index variable
that specifies which page in the property sheet it is.

This almost works accept for one problem. The controls in the base class
don't have a real window associated
with them. When I try to use them, the debugged controls assert
ASSERT(::IsWindow(m_hWnd));
and fail because m_hWnd = 0.

If I move the control message maps into the derived class everything
works (m_hWnd is valid).

Is there a way around this or do I have to redfine the same control
message maps for each derived page?


Thanks in advance,

Rob Adelberg
ARINC

Gerd Mayer
September 23rd, 1999, 10:26 AM
Hello,

try this:

void CMyPage::DoDataExchange(CDataExchange* pDX)
{
CBaseMyPage::DoDataExchange(pDX);

}




I hope it helps:o)


Gerd