Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Deriving a document problem

Status
Not open for further replies.

jcostanz

Programmer
May 24, 2001
36
0
0
US
I am deriving a document from a document that is in a dll.
The document in the dll is derived from CDocument.

Class CReportDoc: public CDocument // contained in a dll


Class CRepWorksDoc: public CReportDoc

IMPLEMENT_DYNCREATE(CRepWorksDoc, CReportDoc)

when i run the program i get a Debug Assertion Failed error
file: doctempl.cpp
line: 32

when I press retry I find the assert failed on:
ASSERT(pDocClass == NULL ||
pDocClass->IsDerivedFrom(RUNTIME_CLASS(CDocument)));

in:
CDocTemplate::CDocTemplate(UINT nIDResource, CRuntimeClass* pDocClass,
CRuntimeClass* pFrameClass, CRuntimeClass* pViewClass)
{

Why is it so?

There are quite a few functions contained in the dll for writing a report. There are no compile errors.

Thanks.
 
Is pDocClass supposed to be NULL at the ASSERT statement? If not, I think it should read ASSERT(pDocClass != NULL || /*other check*/).

HTH.

~Mike
Any man willing to sacrifice liberty for security deserves neither liberty nor security.

-Ben Franklin
 
The problem starts here:

CMultiDocTemplate* pDocTemplate;
pDocTemplate = new CMultiDocTemplate(
IDR_REPWORTYPE,
RUNTIME_CLASS(CRepWorksDoc),
RUNTIME_CLASS(CChildFrame), // custom MDI child frame
RUNTIME_CLASS(CRepWorksView));
AddDocTemplate(pDocTemplate);

 
I found the problem.
I didn't change the Assert function from:
CDocument::Assert()
to:
CReportDoc::Assert()

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top