🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #15078

Printer()->Handle is broke

#15078
From: Anthony
Date: Sat, 19 Jul 2003 18:26
32 lines
2239 bytes
Thanks to Fishface's efforts I make the following public knowledge.

Printer()->Handle is not immediately effected by changing
Printer()->PrinterIndex.  Borland appears to be aware if you dig deep
enough.  Fishface did, and I post the following.

The workaround for changing the printer may involves something like the one
shown in the "vcl\dialog controls\tprintersetupdialog" link on this page:

http://info.borland.com/devsupport/delphi/fixes/delphi4/vcl.html


This little piece of code fixes so many problems.

  Printer->PrinterIndex = x; { set to any non-default printer }
  Printer->GetPrinter(Device, Driver, Port, hDMode);
  Printer->SetPrinter(Device, Driver, Port, 0);

First it gets the correct Handle for the selected printer.  Which then fixes
the page size information.  Which is critical to all us out there trying to
print on different printers each with a different size paper, margins, or
page setup.  ie.  Those of us trying to print on address labels to a
non-default printer who find that the printer incessantly feeds 10 inches of
paper between labels.  The reason is due to wrong handle equals wrong page
size information.

I thank all of those who have posted suggestions to solve my problem over
the last two weeks, including Gambit, JD, Vladimir, Alan, Bob, Hans, and
Midnight Programmer.

Thank you all.
Technical Details
Message-ID: <3f198eec$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-06!sn-xit-01!sn-xit-08!supernews.com!newsfeed.online.be!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,2b22970ca908cea7,start
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-07-19 11:40:06 PST
From: "Anthony" <awhitesell@attbi.com>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Printer()->Handle is broke
Date: Sat, 19 Jul 2003 14:26:25 -0400
Lines: 34
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 24.128.134.183
Message-ID: <3f198eec$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1058639596 24.128.134.183 (19 Jul 2003 11:33:16 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-06!sn-xit-01!sn-xit-08!supernews.com!newsfeed.online.be!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail