Some help to derive from CListBox to add UpDown control



Hi,

I am developping on Smartphone with MFC(next time I will use WTL because it's more appropriate) and I would like to create a control deriving from a CListBox and that add a Updown control.
Actually I want to create the updown control dynamically so that when
I move my control arrows also move.
First I wanted to use the WTL CSpinBox control from MFC (http://www.codeproject.com/wtl/mix_wtl_mfc.asp) but I always got some errors so I have decided to stick with standard MFC for this project.

What I want is to put some CListBox on my dialog in the resource editor
and to declare a class CxSpinListBox that subclass these controls.

It means when they subclass them and they dynamically create a Updown control at their right.
So I am starting with that :


//---------------------------------------------------------------------------//
// PORT CSpinListBox From WTL
//---------------------------------------------------------------------------//
class CxSpinListBox : public CListBox
{
DECLARE_DYNAMIC(CxSpinListBox)

// Constructors
public:
CxSpinListBox();


//overrides
virtual void PreSubclassWindow();

// Message map functions
protected:
//{{AFX_MSG(CCheckListBox)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};


but after I don't know exactly what method I should override.
OnCreate or Create?
PresubclassWindow?

I think I would go with PreSubclassWindow and try to dynamically create a UPDOWNCLASS control but after when I will click on arrow keys how can I be notified ?
Should I include a CSpinButtonCtrl inside my class to handle msgs ?

What I want to do is to have one control that encapsulates my two controls ListBox and CSpinButtonCtrl because I want to be able to do that :


m_spinxFoo.MoveWindow(...) // move CxSpinListbox control at position ...
and not
m_lstFoo.MoveWindow(...) //move listbox at position ...
m_spinFoo.MoveWindow(...)//move updown control to the right of listbox ...

















.