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

Printer tray selection programatically.

Status
Not open for further replies.

techies

Programmer
Nov 1, 2002
24
US

I'm tring to select the papersource of a printer to the user selection and give it to the program to print the report to the selected tray of the printer.
I bring up the CPrintDialog and let the user select the printer and the tray and assign it to a CrystalReport object to print it.

What I'm doing is as follows:

if ( dlg.DoModal() == IDOK )
{
csDriverName = dlg.GetDriverName();
csPrinterName = dlg.GetDeviceName();
csPortName = dlg.GetPortName();
m_bCollateCopies = dlg.PrintCollate() ? true : false;
m_nNumberOfCopies = dlg.GetCopies();
m_nStartPage = dlg.m_pd.nFromPage;
m_nEndPage = dlg.m_pd.nToPage;
bSuccess= true;

pMode = dlg.GetDevMode();

}

switch(int(pMode->dmDefaultSource))
{
case DMBIN_UPPER : spReport->PutPaperSource(CRYSTALCRAXDRT::crPRBinUpper); break;
case DMBIN_LOWER : spReport->PutPaperSource(CRYSTALCRAXDRT::crPRBinLower); break;
case DMBIN_MIDDLE : spReport->PutPaperSource(CRYSTALCRAXDRT::crPRBinMiddle); break;
case DMBIN_MANUAL : spReport->PutPaperSource(CRYSTALCRAXDRT::crPRBinManual); break;
case DMBIN_ENVELOPE : spReport->PutPaperSource(CRYSTALCRAXDRT::crPRBinEnvelope); break;
case DMBIN_ENVMANUAL : spReport->PutPaperSource(CRYSTALCRAXDRT::crPRBinEnvManual); break;
case DMBIN_AUTO : spReport->PutPaperSource(CRYSTALCRAXDRT::crPRBinAuto); break;
case DMBIN_TRACTOR : spReport->PutPaperSource(CRYSTALCRAXDRT::crPRBinTractor); break;
case DMBIN_SMALLFMT : spReport->PutPaperSource(CRYSTALCRAXDRT::crPRBinSmallFmt); break;
case DMBIN_LARGEFMT : spReport->PutPaperSource(CRYSTALCRAXDRT::crPRBinLargeFmt); break;
case DMBIN_LARGECAPACITY : spReport->PutPaperSource(CRYSTALCRAXDRT::crPRBinLargeCapacity); break;
case DMBIN_CASSETTE : spReport->PutPaperSource(CRYSTALCRAXDRT::crPRBinCassette); break;
case DMBIN_FORMSOURCE : //crPRBinFormSource = 15
default:
spReport->PutPaperSource(CRYSTALCRAXDRT::crPRBinFormSource);

}

My problem is pMode->dmDefaultSource does not return me the correct values for some of the tray selections. if i select the lower tray it gives me the correct value of 2(DMBIN_LOWER), but an upper tray or middle tray gives me a value of 257, 259. So I'm not able to send the print to the correct selected tray.
Any help is truely appreciated.

Thanks,
Techies
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top