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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

example of calling RDC from C++

Status
Not open for further replies.

koud0002

Programmer
Jul 18, 2001
6
AU
I would very much appreciate a working example of calling RDC (Report Designer Component) from Microsoft Visual C++.
 
I have tried the example included in “Getting Started with the Crystal Report Designer Component in Microsoft Visual C++” available on Crystal Decisions web site.

However, I get runtime error when executing:
theApp.pReport = theApp.pApplication->OpenReport(FileName);

It appears that theApp.pApplication is not initialized properly.

Do I need to install anything or register any dlls or componets for the example to work?
Thanks
Robert
 
that is the code I use to open a report
CFileDialog Dlg(TRUE, "*.rpt | *.rpt", NULL, OFN_HIDEREADONLY, "Report Files (.rpt)|*.rpt||");

if (Dlg.DoModal() == IDOK ) {
try {
CWaitCursor c;
CString pfad = Dlg.GetPathName().AllocSysString();
m_Report = pApplication->OpenReport(Dlg.GetPathName().AllocSysString());
c.Restore();
}
catch (_com_error& e) {
HandleError(e);
}
}
else { return; }
 
I think the problem is with the following statement:

theApp.pApplication.CreateInstance("CrystalRuntime.Application");

I used the debugger to check the value of theApp.pApplication after the above line has been executed.
theApp.pApplication is NULL.

Therefore, I think CreateInstance fails to create the instance.

thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top