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!

Crystal Reports and a VC++ app?

Status
Not open for further replies.

golyg

Programmer
Jul 22, 2002
319
US
Hi all,
I have a VC++ 6.0 app that uses Crystal Reports 7.0 through API calls to print some reports. The question(s) that I have is not so clear cut.
1. I am becoming more and more confused of how the app prints the reports. After the user decides which report to print in my app, the crystal report dialog is launched and displays the report. when the user clicks on the CR print icon, I have no control of the calls, its in the crpe32.dll hands, correct?

2. So my problem is that I want to either use the printer that the user selects in the app, or give them an option after they decide to print the report, but since the crpe32.dll is in control, I cannot. whatever happens I do not want to print to the system default printer.

Is there a way for Crystal reports to pick up the printer decided in the app rather than the system default printer?????

I am losing my mind, and would greatly appreciate any help.

thank you,
g
 

If you're using the CPREJob class, you could try using CRPEJob::SelectPrinter()

CMR
 
I'm not using that class.
I am using the cpre.h? a crystal reports defined header,
I am trying to use the .PrinterSelect method but I am getting an error message.
I think the usage is:
[form.]Report.PrinterSelect;

but I get an error that states the left side of PrinterSelect myst point ot a class/union/struct.

I tried to supply it the form variable, no luck though.

thanks,
g
 
I am pretty new to C++ but ...

When I receive that error it is because I don't reference the class in a particular line of code or if there is more than 1 constructor declared in a program but not referenced respectively.....even when including the .h file. Are you using a private class?

 
It's a long time ago that I did this, so don't ask me the ins and outs. Besides; It's crystal reports 8 but that probably doesn't matter.

This is how I did it:

CRPEJob* job = m_pApp->m_pJob = m_pApp->m_RPT.OpenJob(sReport); //Create the report object.

if(AfxGetApp()->GetProfileString("Settings\\Application Printer", "devName","") != "") { //An application printer has been selected.
if(m_pApp->CheckPrinterExists()) {
DEVMODE mode;
mode.dmSize = sizeof(DEVMODE);
mode.dmOrientation = bLandscape ? DMORIENT_LANDSCAPE : DMORIENT_PORTRAIT;
mode.dmPaperSize = DMPAPER_A4;
mode.dmPrintQuality = DMRES_HIGH;
mode.dmFields = DM_ORIENTATION|DM_PAPERSIZE|DM_PRINTQUALITY;
job->SelectPrinter(AfxGetApp()->GetProfileString("Settings\\Application Printer", "drvName",""), AfxGetApp()->GetProfileString("Settings\\Application Printer", "devName",""), AfxGetApp()->GetProfileString("Settings\\Application Printer", "portName",""), &mode);
}
}

Greetings,
Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top