Subclassed Control
-
hi.. I create a subclassed MFC ActiveX control .. Subclassed from the Listbox control .. a have a method that should add an item : the code causes an assertion .. can anyone help ?
void CSubCtrl::AddItem(BSTR FAR* strItem) { CString st(*strItem); //AfxMessageBox(st); CListBox lb; lb.Attach(COleControl::m_hWnd); lb.AddString(st); lb.Detach(); }
-
hi.. I create a subclassed MFC ActiveX control .. Subclassed from the Listbox control .. a have a method that should add an item : the code causes an assertion .. can anyone help ?
void CSubCtrl::AddItem(BSTR FAR* strItem) { CString st(*strItem); //AfxMessageBox(st); CListBox lb; lb.Attach(COleControl::m_hWnd); lb.AddString(st); lb.Detach(); }
When talking about assertion, it's needed to know what is its condition from the file it exists in. However, I guess that the possible assertion that could occur in your code is the IsWindow() assertion (
ASSERT(::IsWindow(hWnd))
which indicate the theHWND
passed to the Attach() function is invalid. When you get an assertion in debug mode, click retry to see the assertion condition. -
When talking about assertion, it's needed to know what is its condition from the file it exists in. However, I guess that the possible assertion that could occur in your code is the IsWindow() assertion (
ASSERT(::IsWindow(hWnd))
which indicate the theHWND
passed to the Attach() function is invalid. When you get an assertion in debug mode, click retry to see the assertion condition.Hi.. the asseion occures in
Attach
method .. when i step in the code i find thatASSERT(FromHandlePermanent(hWndNew) == NULL);
causes an assetion.. any suggestion please ?