OutPut Bin Selection for a printer

I am working on a project with Oracle 8 as Back end and Delphi 4 as front End.
The printer we use now is HP LaserJet 4050TN. Now we have 4 bins in it and the report we are using is Quick Report
latest vesrion. Here the first bin(Manual) is detected by Selecting 'First  ' in TQRBIN.second bin is selected using 'lower' and the fourth is selected using 'Last'. But I cannot pass a bin for Third bin .I tried with 'Middle' but it is not been recognised and it takes the default. Now I have kept the 3rd bin as default in the Printer properties. Please give me a Solution for this. Is there anything like Escape Sequence(DOS) for Windows to choose the Bin


sethurajAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

intheCommented:
here is example of changing  the   papersizes and bins:

unit Unit1;

interface

uses
  Windows, Messages,Printers, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
var
Device : array[0..255] of char;
Driver : array[0..255] of char;
Port   : array[0..255] of char;
hDMode : THandle;
PDMode : PDEVMODE;
begin
  Printer.GetPrinter(Device, Driver, Port, hDMode);
  if hDMode <> 0 then begin
    pDMode := GlobalLock(hDMode);
    if pDMode <> nil then begin

     {Set to legal}
      pDMode^.dmFields := pDMode^.dmFields or dm_PaperSize;
      pDMode^.dmPaperSize := DMPAPER_LEGAL;

     {Set to custom size}
      pDMode^.dmFields := pDMode^.dmFields or
                          DM_PAPERSIZE or
                          DM_PAPERWIDTH or
                          DM_PAPERLENGTH;
      pDMode^.dmPaperSize := DMPAPER_USER;
      pDMode^.dmPaperWidth := 100 {SomeValueInTenthsOfAMillimeter};
      pDMode^.dmPaperLength := 100 {SomeValueInTenthsOfAMillimeter};

     {Set the bin to use}
      pDMode^.dmFields := pDMode^.dmFields or DMBIN_MANUAL;
      pDMode^.dmDefaultSource := DMBIN_MANUAL;

      GlobalUnlock(hDMode);
   end;
  end;
Printer.PrinterIndex := Printer.PrinterIndex;
Printer.BeginDoc;
Printer.Canvas.Font.Name := 'Courier New';
Printer.Canvas.Font.Size := 10;
Printer.Canvas.Font.Color:=ClRed;
 Printer.Canvas.TextOut(100,100, 'Test 1');
 Printer.EndDoc;
end;
end.


press ctrl space after DMBIN_
for a list of bins you can use.one of them is DMBIN_USER which may be what your after.
Regards Barry
0
PradeepPrabhakarCommented:
You can use the DeviceCapabilities API function "DeviceCapabilities" declared in the WinSpool.pas with the DC_BINS or the DC_BINNNAMES parameters to retrieve an array of bins installed for the printer you are querying or the array of names of the bins you want to access respectively.
The DC_BINNAMES parameter retreives an array of PDeviceMode datatypes. The Delphi implementation of this data structure is in the Windows.pas
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rajeshveeCommented:
If U use the above method by Mr .Pradeep U don't have to write a wrapper function for the Api.

rajesh.vijayakumar.
0
PradeepPrabhakarCommented:
No you do not have to create a wrapper. It is already wrappered in the WinSpool.Pas. For the implementation look in the /Delphi/Source/Rtl/Win directory.
0
sethurajAuthor Commented:
Thanx Guys
I will check and return
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.