I'm pulling my hair out at tho moment over run time errors, I seem to get another exception / debug assert error for every other line I write.

One that's causing me confusion is:

Code:
BOOL CMyPropPage::OnSetActive() 
{
	CMyFormDoc* pDoc = (CMyFormDoc*)GetDocument();

	return CPropertyPage::OnSetActive();
}
The reported error is on line 45 of objcore.cpp. Can anyone solve this and give me some tips on why these things occur?

-edit-
I'm using MFC and VC6 with an appwizard generated MDI using doc/view.