?
Solved

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

Posted on 1997-04-03
3
Medium Priority
?
483 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 150 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

Percona Live Europe 2017 | Sep 25 - 27, 2017

The Percona Live Open Source Database Conference Europe 2017 is the premier event for the diverse and active European open source database community, as well as businesses that develop and use open source database software.

Question has a verified solution.

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

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses
Course of the Month15 days, 1 hour left to enroll

770 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