Click here to Skip to main content
15,893,161 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi all

I have a button class :


class CTransparentBtn : virtual public CWindowImpl<ctransparentbtn, WTL::CButton, CControlWinTraits>
{
// ...
};

and I've found this class for menu button from codeproject.com


namespace WTLEX
{

template <bool class="" tbase="WTL::CButton," twintraits="CControlWinTraits">
class ATL_NO_VTABLE CMenuButtonImpl : public CWindowImpl< T, TBase, TWinTraits>
{
// ...
};

class CMenuButton : public CMenuButtonImpl<false, CMenuButton>
{
// ...
};

} //namespace WTLEX</bool>

so How can I derive "CMenuButton" from "CTransparentBtn" to use CTransparentBtn's functions??

thank u in advance
Posted
Updated 21-May-11 1:16am
v3

you're still going to have to template your CTransparentBtn if you go the other way

template <class theClass, class theBase>
class CTransparentBtn : public CWindowImpl<theClass, theBase, CControlWinTraits>



then

template <class theClass,class theBase>
class ATL_NO_VTABLE CMenuButtonImpl : public CTransparentBtn <theClass, theBase>
 
Share this answer
 
Comments
bartello 22-May-11 15:42pm    
Ok!! thanks a lot!! :)
wouldn't you go the other way?

class CTransparentBtn : public CMenuButtonImpl<ctransparentbtn,wtl::cbutton,ccontrolwintraits>
{
// ...
};
 
Share this answer
 
Comments
bartello 21-May-11 7:20am    
thanks! but it's harder than u think. In this case I had to add some template arguments to class CTransparentBtn. I'd like to know the answer to MY question.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900