[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 498
  • Last Modified:

How to correctly expand MFC's DECLARE_DYNAMIC etc when trying to utilize templates

I have run into a number of situations where I would like to utilize templates as well as take advantage of the features of CObject etc.  I know that the macros themselves can't be used to successfully accomplish this.  I have tried several times to expand them out and get the compile to work correctly. (Both the DLL and EXE versions of the macros mind you.) Alas, no success.  Has anyone else run into this problem?
0
andy.bronson
Asked:
andy.bronson
1 Solution
 
mbhaktaCommented:
Can you tell me your problem more in detail, its symptoms etc.
0
 
andy.bronsonAuthor Commented:
An example might be that I have a class hierarchy representing some data type.  (recordsets for example). I want to display results in a list box from a standard set of recordsets in a list box.

I want to create a template that derives from the CListBox control that takes one of these data types as an argument.  I want to have runtime class information for this list box as well.

I have no problem with the template itself.  It's just that I can't seem to correctly expand the DECLARE_DYNAMIC/IMPLEMENT_DYNAMIC macros.

Thanks
0
 
RONSLOWCommented:
Derive a class from the templated class, and then get run-time info from THAT class.eg.template <class T> class CXT : public CObject {..};class CX : public CXT<int> {    DECLARE_DYNAMIC(...)};
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now