cannot Create CListBox : CFormView without IDD
-
I cannot create MyListBox derived from CFormView. The docs say I can put the Create call in the MyListBox ctor. I get these errors: // dialog template must exist and be invisible with WS_CHILD set // invalid dialog template name I don't want to create a resource dialog template, however, like an IDD_... because my listbox is just a PLACE_HOLDER control in a resource control. How do I get the object created without a dialog resource IDD?
-
I cannot create MyListBox derived from CFormView. The docs say I can put the Create call in the MyListBox ctor. I get these errors: // dialog template must exist and be invisible with WS_CHILD set // invalid dialog template name I don't want to create a resource dialog template, however, like an IDD_... because my listbox is just a PLACE_HOLDER control in a resource control. How do I get the object created without a dialog resource IDD?
What does the relevant code look like?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
-
What does the relevant code look like?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
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 nameI 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.