Solved

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

Posted on 1997-04-03
3
444 Views
Last Modified: 2013-11-20
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
Comment
Question by:andy.bronson
3 Comments
 
LVL 4

Expert Comment

by:mbhakta
Comment Utility
Can you tell me your problem more in detail, its symptoms etc.
0
 

Author Comment

by:andy.bronson
Comment Utility
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
 
LVL 10

Accepted Solution

by:
RONSLOW earned 50 total points
Comment Utility
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now