Solved

Printing

Posted on 2003-11-22
1
260 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
[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
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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
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
Course of the Month6 days, 11 hours left to enroll

623 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