class MyListBoxView : public CFormView
{
...
CListBox m_wndListBox;
MyListBoxView::MyListBoxView()
: CFormView( IDC_LIST1 ) // ID is a LISTBOX control in another .rc file
{
Create( WC_LISTBOX, L"My devices", WS_CAPTION | WS_CHILD | WS_VISIBLE, CRect( 0, 0, 0, 0 ), this, IDC_LIST1, ( CCreateContext* )NULL );
**Create** fails at:
if (!_AfxCheckDialogTemplate(m_lpszTemplateName, TRUE))
{
ASSERT(FALSE); // invalid dialog template name
I have tried to do w_wndListBox.Create(...), but CFormView::Create is protected and can't be called from outside. I have also tried to call Create in MyListBoxView's ctor, using the static call form (CFormView::Create), but that fails because Create, of course, is not a static and you can't call non-statics from a static. So I must have the class and object structure wrong for these calls not to work.