Gerry Murphy wrote:
Initialize the list box after calling CFormView::OnInitialUpdate.
If I do that in Debug mode I get an assert in WINCORE.CPP
at the second line below:
BOOL CWnd::Attach(HWND hWndNew)
{
ASSERT(m_hWnd == NULL); // only attach once, detach on destroy
ASSERT(FromHandlePermanent(hWndNew) == NULL);
// must not already be in permanent map
if (hWndNew == NULL)
return FALSE;
_afxMapHWND.SetPermanent(m_hWnd = hWndNew, this);
return TRUE;
}
In release mode it crashes.
My hunch is that I may have to move the function calls that load the
listboxes out of OnInitialUpdate(), but then I'm not sure where to
call them.
Thanks,
Gerry Murphy
This function would not be called from m_listbox.AddString(), so its not
clear what's going on. It would be useful to have a look at the stack at
this point and find out why Attach is being called. The assert failure
implies an attempt to connect the control variable to the control twice.
Review any calls to DDX_CONTROL and/or SubclassDlgItem.
--
Scott McPhillips [VC++ MVP]
CFormView::OnInitialUpdate, not AddString().