Solved

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

Posted on 1997-04-03
3
475 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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seveā€¦
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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 is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

729 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