Solved

Printing

Posted on 2003-11-22
1
257 Views
Last Modified: 2010-04-03
Hi,

I need to know how I can set a printers properties to be default at Tractor Feed.
Every time I use my printer the paper source resets itself to Manual Feed. I have disabled Manual and Sheet Feeder in the printer properties but this doesnt work.

When I select my printer using the printerdialog I need the default paper source to be Tractor and paper output to be 8 1/2 x 11.

Is there any way I can set this in code? Im using Delphi 5 Prof and the dialog is TPrinterDialog

Any suggestions would be great,
Thanks
0
Comment
Question by:HotRod40
1 Comment
 
LVL 3

Accepted Solution

by:
Peter_ earned 100 total points
ID: 9805654
Havent tried this yet, but I found the sample on the net and it looks like it could work. Try setting the different properties of pDMode:

//-------------------------------------------------------------------------

procedure TForm1.Button2Click(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
      pDMode^.dmPaperSize:=DMPAPER_LEGAL;
      { There are many more parameters here you can try, and other properties like pDMode^.dmDefaultSource
      for example. }
      GlobalUnlock(hDMode);
    end;
    GlobalFree(hDMode);
  end;
end;

//------------------------------------------------------------------------

If all else fails, then maybe you could try using SendKeys on the dialog?
 
Depends on if you are able to get hold of the right window. Takes some "trial and error programming", but sometimes it does the trick. See http://www.cbuilder.ru/faqs/faqd_en/16500.html http://www.209software.com/Books/p4dp/sendkeys.html for a sample.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

792 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