Print Page | Close Window

Correct base class in MFC macro?

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=5729
Printed Date: 11 November 2025 at 8:39pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Correct base class in MFC macro?
Posted By: Warren
Subject: Correct base class in MFC macro?
Date Posted: 08 December 2006 at 1:07pm
I was wondering about the proper base class in the MFC macros,  when you multiply derive something. In the shortcutbar sample, the .h file looks like:

class CMainFrame : public CXTPFrameWnd, CXTPOffice2007FrameHook
{
DECLARE_DYNCREATE(CMainFrame)
...

and the .cpp file looks like:

IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)

...

I would have thought that the second parameter to these macros should be CXTPFrameWnd ?

I haven't used multiple-derivation with my own MFC classes much, mainly because of this issue. My assumption would be that you're okay to do this:
1) as long as the second class doesn't also derive from MFC's CObject,
2) you use the CObject derived name in the MFC macros, so the messages get passed to the right class.

Everything seems to be working fine as is, I'm just nervous about doing something wrong, so I'd appreciate a codejock comment on the issue.

Thanks very much

Warren

P.S. I'm using version 10.3.1 of the 'kit



Replies:
Posted By: Oleg
Date Posted: 15 December 2006 at 2:04pm

you right, you can do it.

1. right.
2. right. only CCmdTarget....
 
 
better use CXTPFrameWnd. Message maps/dyanamic checking don't use now for CXTPFrameWnd, but how knows may be later we will add something...


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net