I've got a full function but in trying to find the source of the error I had commented everything out except that line, my full function is
Code:
/////////////////////////////////////////////////////////////////////////////
// CMyPropPage message handlers
CTykeDoc* CMyPropPage::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CTykeDoc)));
return (CTykeDoc*)m_pDocument;
}
BOOL CMyPropPage::OnSetActive()
{
CTykeDoc* pDoc = (CTykeDoc*)m_pDocument->IsKindOf(RUNTIME_CLASS(CTykeDoc));//GetDocument();
//** get pointers to the recordsets
m_pMyDaoRecordSet = pDoc->m_pMyDaoRecordSet;
UINT nCount =PopulateCustomerList();
if( nCount > 0 )
{
this->m_CustomerList.SetCurSel( 0 );
}
//CreateTabs();
return CPropertyPage::OnSetActive();
}
UINT CMyPropPage::PopulateCustomerList()
{
UINT nCount = 0;
ASSERT( m_pMyDaoRecordSet->IsOpen() == TRUE);
try{
if( !m_pMyDaoRecordSet->IsBOF() )
{
m_CustomerList.ResetContent();
m_pMyDaoRecordSet->MoveFirst();
while( !m_pMyDaoRecordSet->IsEOF() )
{
m_CustomerList.AddString( m_pMyDaoRecordSet->m_CCompany_Name );
m_pMyDaoRecordSet->MoveNext();
nCount++;
}
}
}
catch(CDaoException* e;)
{
e->ReportError();
e->Delete();
}
return nCount;
}
I can send the full thing as an attachment if needed but it's too much to post here.
Here's the line it fails on in objcore:
Code:
BOOL CObject::IsKindOf(const CRuntimeClass* pClass) const
{
ASSERT(this != NULL);
// it better be in valid memory, at least for CObject size
ASSERT(AfxIsValidAddress(this, sizeof(CObject)));
// simple SI case
CRuntimeClass* pClassThis = GetRuntimeClass();
return pClassThis->IsDerivedFrom(pClass); // POINTS TO HERE
}
A lot of the code is adapted from zMan's demo, just so he doesnt think I'm taking credit, the functions in his demo are used inside a CFormView class, instead of CPropertyPage and he uses OnInitUpdate where I have used OnSetActive.