
Subclassing in a composite ATL control
Thanks,
excellent - that is exactly what I was trying to do
class CMyListView : public CWindowImpl<CMyListView,
ATLControls::CListViewCtrl, CControlWinTraits>
I did subclassing with a separate class but obviously that wasn't the best
solution.
Dmitri
Quote:
> Well, yes, you don't subclass at all. Replace Attach with SubclassWindow
> and derive your class from CWindowImpl:
> class CMyListView :
> piblic CWindowImpl<CMyListView, ATLControls::CListViewCtrl,
> CControlTraits>
> --
> =====================================
> Alexander Nickolov
> Microsoft MVP [VC], MCSD
> MVP VC FAQ: http://www.mvps.org/vcfaq
> =====================================
> > Hi ,
> > I have a following problem
> > A composite control includes atlcontrols.h and uses MFC.
> > I've derived a class like
> > #include "atlcontrols.h"
> > using namespace ATLControls;
> > class CMyListView : public ATLControls::CListViewCtrl
> > {
> > public:
> > BEGIN_MSG_MAP(CMyListView)
> > MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown)
> > END_MSG_MAP()
> > CMyListView();
> > virtual ~CMyListView();
> > LRESULT OnLButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL&
> > bHandled)
> > {
> > AfxMessageBox("left button down");
> > return TRUE;
> > }
> > };
> > I also have in my control class ---------------
> > public:
> > CMyListView m_List;
> > and -----------
> > LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL&
> > bHandled)
> > {
> > m_List.Attach(GetDlgItem(IDC_LIST1));
> > I am unable to trap window messages in CMyListView. What could be the
> > problem? Am I doing the subclassing wrong>?
> > Thanks,
> > D.G.