Link to home
Start Free TrialLog in
Avatar of lonicekm
lonicekm

asked on

MESSAGE_MAP in template class

I have a small problem, how to write MESSAGE_MAP in template class. I've something like "template <class DLGCLASS> class CMyComboBox : public CComboBox" and I don't know how to write "BEGIN_MESSAGE_MAP(???, CComboBox)". I want only to know how (and if) I can do it, no how to do it by another way f.e. as not template class. Thanks.
Avatar of gandalf79
gandalf79

you would write something like:

BEGIN_MESSAGE_MAP(CMyComboBox<DLGCLASS>, CComboBox)
     ...
END_MESSAGE_MAP()

the compiler will make a new copy of CMyComboBox each time you place a new variable type into the class. DLGCLASS will be replaced at that time with the apropreate type.
Avatar of lonicekm

ASKER

Did u try it? Sure I tried this possibility and

error C2065: 'DLGCLASS' : undeclared identifier
error C2955: 'CMyComboBox' : use of class template requires template argument list
error C2039: '_GetBaseMessageMap' : is not a member of 'CMyComboBox'
...
and many others.
ASKER CERTIFIED SOLUTION
Avatar of gandalf79
gandalf79

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Dear lonicekm

I think you forgot this question. I will ask Community Support to close it unless you finalize it within 7 days. You can always request to keep this question open. But remember, experts can only help you if you provide feedback to their questions.
Unless there is objection or further activity,  I will suggest to accept

     "gandalf79"

comment(s) as an answer.

If you think your question was not answered at all, you can post a request in Community support (please include this link) to refund your points. The link to the Community Support area is: https://www.experts-exchange.com/commspt/

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
======
Werner
Force accepted

** Mindphaser - Community Support Moderator **