Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Changing the bin of the printer?

Posted on 1998-10-22
4
Medium Priority
?
259 Views
Last Modified: 2010-04-06
Hi!

I know how to retrieve the name of the available bins for a specific printer. I also know how to change papersize and -orientation programmatically...
BUT how do I tell the printer what bin to use, programmatically?
And can I change bins in the middle of a printout (page 1 requires Manual Feed and page 2 uses the Default Tray)?

I use D2, W98.

//Daniel
0
Comment
Question by:Dippen
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 8

Accepted Solution

by:
ZifNab earned 150 total points
ID: 1343918
Hi Dippen,

1.
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.PrinterIndex := Printer.PrinterIndex;
  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.TextOut(100,100, 'Test 1');
  Printer.EndDoc;
 end;

2. Don't know...
   But you can if you do this
   change bin
   use begindoc, enddoc
   change bin
   use begindoc, enddoc

Regards, Zif.
0
 

Author Comment

by:Dippen
ID: 1343919
Hi, Zif!

Do you by any chance know what the available constants for setting the BIN are (besides DMBIN_MANUAL)? I couldn't find them in the online-help?

//Daniel
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1343920
Hi Dippen,

unfortunately I don't know...

But with this function

DWORD DeviceCapabilities(

    LPCTSTR  pDevice,      // pointer to a printer-name string
    LPCTSTR  pPort,      // pointer to a port-name string
    WORD  fwCapability,      // device capability to query
    LPTSTR  pOutput,      // pointer to the output
    CONST DEVMODE *  pDevMode       // pointer to structure with device data  
   );      

And using DC_BINS, you should get them... but i'm not sure about this.

while searching for an answer on your second q'n, I heard about the existance of this component : (it is shareware dough)

Http://www.skzl.nl/~hsteigstra

Zif.
0
 

Author Comment

by:Dippen
ID: 1343921
OK, thanks! I'll see what I can figure out myself. For example, I've found out that the constant DMBIN_UPPER and DMBIN_LOWER also exists.

//Daniel
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question