Solved

Printing

Posted on 2003-11-22
1
255 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
Comment Utility
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

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…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

744 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now