Re: Send message issue
David:
Its not the m_ListCtrlTwo that is null.
I
Its the dialog that I get assertion .
ASSERT_VALID(mv->m_myCtrlTab.userDlg);
and goes to objcore.cpp line no 90
// check to make sure the VTable pointer is valid
ASSERT(sizeof(CObject) == sizeof(void*));
if (!AfxIsValidAddress(*(void**)pOb, sizeof(void*), FALSE))
{
TRACE(traceAppMsg, 0, "ASSERT_VALID fails with illegal
vtable
pointer.\n");
if (AfxAssertFailedLine(lpszFileName, nLine))
AfxDebugBreak();
return; // quick escape
}
Both the view and the tabcontrol are valid.
userDlg is a CDialog class inside the tab control.
userdialog was created in the onitialupdate of CFormview
CUserDataDlg *tabUserData = new CUserDataDlg();
m_myCtrlTab.m_nNumberOfPages=1;
m_myCtrlTab.m_tabCurrent=0;
tabUserData->Create(IDD_DLG_USER_DATA,&m_myCtrlTab);
I know this is abad design and advise me to follow the good design.
how should I send a message then?
How to correct this ?
Pls guide.
David Wilkinson wrote:
nicetom786@yahoo.com wrote:
Ajay,
I did not confirm from Spy++.
the debugger breaks at
mv->m_myCtrlTab->mydialog->m_ListCtrlTwo.SendMessage(WM_INSERT_ITEMS,0,0);
stating the window of is null.
nicetom:
So you have this CWnd variable m_ListCtrlTwo that has a NULL m_hWnd.
Presumably you think it should not be. Then there must be a statement in
your code that you think should cause this m_hWnd to be non-NULL.
Depending on the situation, it could be Create(), DDX_Control,
SubclassWindow, SubclassDlgItem, maybe others. Place a break right after
this call, and check that the code is executed and that the m_hWnd is
non-NULL. If it is not NULL, then look for places where you might be
destroying this window. And make sure that the m_ListCtrlTwo whose
m_hWnd is non-NULL belongs to the correct object.
I would have to say that a string like
mv->m_myCtrlTab->mydialog->m_ListCtrlTwo.SendMessage()
indicates a very poor design.
David Wilkinson
David Wilkinson