From: shogun_argentina on
I need to get Crystal reports running on an MFC application, Does
anyone have an example, or know where i can find one?.
I looked into
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/crystlmn/html/crsamreportbindingoptionsforwindowsformsviewers.asp

But couldnt get it working, i think im missing something, I cannot find
the "Windows Forms Viewer" and after adding the namespaces and setting
"ReportDocument *oRpt = null;" i get a :

error C3624: 'System::ComponentModel::Component': the compiler cannot
find this type; it is defined in the assembly 'System'

Any help would be welcome, ahh i tried the examples in the
http://www.crystaldecisions.com but they link to an OCX i cannot find,
again :(

Pls help!

From: Eddie Pazz on
If it's a MFC project, I usually use the Crystal APIs. You have to include
the CRW libraries:

// Crystal Reports header file and exports (fix to path where your CR is
installed)
#include "crpe.h"
#include "Uxftext.h"
#include "Uxddisk.h"

// The library
#pragma comment( lib, "crpe32m.lib" )

// Start the engine and start the print job
PEOpenEngine();
Short iJob = PEOpenPrintJob( "<THE REPORT PATH>" );

// Print to the default printer
PEOutputToPrinter( iJob, 1 ) ;

// Close the engine
PECloseEngine();

It's pretty straight forward.

"shogun_argentina" <miguelhatrick(a)gmail.com> wrote in message
news:1111006567.410386.280580(a)o13g2000cwo.googlegroups.com...
>I need to get Crystal reports running on an MFC application, Does
> anyone have an example, or know where i can find one?.
> I looked into
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/crystlmn/html/crsamreportbindingoptionsforwindowsformsviewers.asp
>
> But couldnt get it working, i think im missing something, I cannot find
> the "Windows Forms Viewer" and after adding the namespaces and setting
> "ReportDocument *oRpt = null;" i get a :
>
> error C3624: 'System::ComponentModel::Component': the compiler cannot
> find this type; it is defined in the assembly 'System'
>
> Any help would be welcome, ahh i tried the examples in the
> http://www.crystaldecisions.com but they link to an OCX i cannot find,
> again :(
>
> Pls help!
>


From: jibesh on
Hi
If you have Crystal report insatlled in your machine you can directly
use the Crystalreport Control in your application .
Still you can use several Interfaces provided by the Control like
IReport,ICrystalReportViewer3 etc etc.
Supportive needed files are crxviewer.dll,craxdrt.dll,crxlat32.dll
etc...

Jibesh.V.P.
www.m2comsys.com


--


-------------------------------------------------------------------------
FIGHT BACK AGAINST SPAM!
Download Spam Inspector, the Award Winning Anti-Spam Filter
http://mail.giantcompany.com


"Eddie Pazz" <drpazz(a)hotmail.com> wrote in message
news:ehfzPQtKFHA.2604(a)TK2MSFTNGP10.phx.gbl...
> If it's a MFC project, I usually use the Crystal APIs. You have to include
> the CRW libraries:
>
> // Crystal Reports header file and exports (fix to path where your CR is
> installed)
> #include "crpe.h"
> #include "Uxftext.h"
> #include "Uxddisk.h"
>
> // The library
> #pragma comment( lib, "crpe32m.lib" )
>
> // Start the engine and start the print job
> PEOpenEngine();
> Short iJob = PEOpenPrintJob( "<THE REPORT PATH>" );
>
> // Print to the default printer
> PEOutputToPrinter( iJob, 1 ) ;
>
> // Close the engine
> PECloseEngine();
>
> It's pretty straight forward.
>
> "shogun_argentina" <miguelhatrick(a)gmail.com> wrote in message
> news:1111006567.410386.280580(a)o13g2000cwo.googlegroups.com...
> >I need to get Crystal reports running on an MFC application, Does
> > anyone have an example, or know where i can find one?.
> > I looked into
> >
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/crystlmn/html/crsamreportbindingoptionsforwindowsformsviewers.asp
> >
> > But couldnt get it working, i think im missing something, I cannot find
> > the "Windows Forms Viewer" and after adding the namespaces and setting
> > "ReportDocument *oRpt = null;" i get a :
> >
> > error C3624: 'System::ComponentModel::Component': the compiler cannot
> > find this type; it is defined in the assembly 'System'
> >
> > Any help would be welcome, ahh i tried the examples in the
> > http://www.crystaldecisions.com but they link to an OCX i cannot find,
> > again :(
> >
> > Pls help!
> >
>
>


From: River Ross on
Make sure you test your application by installing it on a machine that
doesn't have Crystal Reports installed. The CR runtime files you install
really depend on what features you use, for example if you export to html
there's certain files for that, etc.

here is some random code grabbed from various places, this is using CR9 so
your version may be different.

#import "craxdrt9.dll" no_namespace
#import "Cdo32.dll" no_namespace

class CMyReport
{
public:

protected:
IApplicationPtr m_Application;
IReportPtr m_Report;

}



static IApplicationPtr pAppPtr=NULL;

CMyReport::CMyReport()
{
HRESULT hr=m_Application.CreateInstance("CrystalRuntime.Application");
if(!SUCCEEDED(hr))
{
CString strMsg="Unable to create CrystalRuntime.Application instance. "
"The most likely reason for this error is that the required Crystal
Report Runtime files "
"are either not installed or not functional.";
AfxMessageBox(strMsg);

return;
} else pAppPtr=m_Application;
}

CMyReport::~CMyReport()
{
if (m_Report)
{
m_Report.Release();
m_Report = NULL;
}
//if (m_Application)
//{
//m_Application.Release();
//m_Application = NULL;
//}

}
.....

int CMyReport::OpenReport(CString strReportFile)
{

if (m_Application == NULL)
return -1;
_bstr_t bstrReport(strReportFile);
m_Report = m_Application->OpenReport(bstrReport);
if (m_Report == NULL)
return -1;
return 0;
}

void CMyReport::Print(BOOL bPreviewMode)
{
if (bPreviewMode)
{
CDlgReport dlg(m_Report); //this is a whole other class where you put the
viewer onto a dialog box
dlg.DoModal();
}
else
{
m_Report->PrintOut(_variant_t(true));
}
}

"shogun_argentina" <miguelhatrick(a)gmail.com> wrote in message
news:1111006567.410386.280580(a)o13g2000cwo.googlegroups.com...
>I need to get Crystal reports running on an MFC application, Does
> anyone have an example, or know where i can find one?.
> I looked into
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/crystlmn/html/crsamreportbindingoptionsforwindowsformsviewers.asp
>
> But couldnt get it working, i think im missing something, I cannot find
> the "Windows Forms Viewer" and after adding the namespaces and setting
> "ReportDocument *oRpt = null;" i get a :
>
> error C3624: 'System::ComponentModel::Component': the compiler cannot
> find this type; it is defined in the assembly 'System'
>
> Any help would be welcome, ahh i tried the examples in the
> http://www.crystaldecisions.com but they link to an OCX i cannot find,
> again :(
>
> Pls help!
>