Solved

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

Posted on 1997-04-03
3
464 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 4

Expert Comment

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

Author Comment

by:andy.bronson
ID: 1300823
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
ID: 1300824
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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
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 …
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.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

749 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