 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Gunnar Beushausen Guest
|
Posted: Wed Mar 16, 2005 2:17 pm Post subject: How to select a paper tray in QuickReports? |
|
|
Hi!
We have a pretty large application that relies on QuickReports. For one
new module we have to select the paper tray from wich the printer should
print the report.
However no matter which tray we select in the preview form of
QuickReports, it gets always printed to the standard tray.
The QuickReport FAQ mentions this problem for HP printers, but it
doesn't matter what printer we use (mainly oki) it's the same on every
single printer.
We used BCB 6.0. Does anybody have any clues?
Thanks in advance,
Gunnar
|
|
| Back to top |
|
 |
Martin Hart - Memory Soft Guest
|
Posted: Fri Mar 18, 2005 6:23 pm Post subject: Re: How to select a paper tray in QuickReports? |
|
|
Gunnar:
Her's some code I had for detecting Paperbins, it might help.
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
#include "Printers.hpp"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "UCrpe32"
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
PrinterSetupDialog->Execute();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
binClick(Sender);
if(cbToScreen->Checked)
Crpe->Output = toWindow;
else
Crpe->Output = toPrinter;
Crpe->Execute();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::binClick(TObject *Sender)
{
DEVMODE *devMode = NULL;
//Crpe->Printer->GetCurrent(true);
Crpe->Printer->Retrieve();
devMode = Crpe->Printer->PMode;
if(devMode != NULL)
{
switch(bin->ItemIndex)
{
case 0: //---Default
devMode->dmFields |= 0x200;
devMode->dmDefaultSource = short(1);
break;
case 1: //---Lower
devMode->dmFields |= 0x200;
devMode->dmDefaultSource = short(2);
break;
case 2: //---Middle
devMode->dmFields |= 0x200;
devMode->dmDefaultSource = short(3);
break;
case 3: //---Manual
devMode->dmFields |= 0x200;
devMode->dmDefaultSource = short(4);
break;
case 4: //---Auto
devMode->dmFields |= 0x200;
devMode->dmDefaultSource = short(7);
break;
case 5: //---Custom
devMode->dmFields |= 0x200;
devMode->dmDefaultSource = short(binNum->Text.ToIntDef(0));
break;
}
//if(!PESelectPrinter(Crpe->JobNumber(), Crpe->Printer->Driver.c_str(),
Crpe->Printer->Name.c_str(), Crpe->Printer->Port.c_str(), devMode))
// MessageBeep(-1);
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button3Click(TObject *Sender)
{
DEVMODE devMode;
unsigned int ADeviceMode;
char binNames[50][24];
WORD count, binValues[50];
char ADevice[64], ADriver[64], APort[64];
int prnIdx = Printer()->PrinterIndex;
if(prnIdx == -1)
{
ShowMessage("No default printer is present.");
return;
}
memset(&binValues, 0, sizeof(binValues));
memset(&binNames, 0, sizeof(binNames ));
memset(&ADevice, 0, sizeof(ADevice ));
memset(&ADriver, 0, sizeof(ADriver ));
memset(&APort, 0, sizeof(APort ));
Printer()->GetPrinter(ADevice, ADriver, APort, ADeviceMode);
DeviceCapabilities(Printer()->Printers->Strings[prnIdx].c_str(), APort,
DC_BINS, (char*)&binValues, NULL);
count = DeviceCapabilities(Printer()->Printers->Strings[prnIdx].c_str(),
APort, DC_BINNAMES, (char*)&binNames, NULL);
binList->Items->Clear();
binList->Items->Add(Format("%d bins have been found", OPENARRAY(TVarRec,
(count))));
for(int i = 0; i < count; i++)
binList->Items->Add(Format(" - %d %s (%d)", OPENARRAY(TVarRec, (i +1,
binNames[i], binValues[i]))));
}
//---------------------------------------------------------------------------
Regards,
Martin.
"Gunnar Beushausen" <gunnar@localhost> escribió en el mensaje
news:42383f70 (AT) newsgroups (DOT) borland.com...
| Quote: | Hi!
We have a pretty large application that relies on QuickReports. For one
new module we have to select the paper tray from wich the printer should
print the report.
However no matter which tray we select in the preview form of
QuickReports, it gets always printed to the standard tray.
The QuickReport FAQ mentions this problem for HP printers, but it doesn't
matter what printer we use (mainly oki) it's the same on every single
printer.
We used BCB 6.0. Does anybody have any clues?
Thanks in advance,
Gunnar
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|