🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: TPrinter Problem

#15121
From: Anthony
Date: Wed, 16 Jul 2003 04:30
62 lines
3462 bytes
Gambit,

I haved solved the latter problems below with the help of JD, using this
code to get a handle for the printer:
char Device[ 256 ] = { 0 };
char Driver[ 256 ] = { 0 };
char Port[ 256 ] = { 0 };
THandle hDeviceMode;
Printer()->PrinterIndex = prnComboBox->ItemIndex;
Printer()->GetPrinter( Device, Driver, Port, hDeviceMode );

The question of using the TCanvas methods vs. the API routines comes into a
question of functionality.  You will also find this question in another
post, but I will also pose it here.

I am printing on address labels that are 1 inch tall.  When I issue
Printers()->NewPage() the printer feeds 10 inches of paper skipping 10
labels. But if I issue StartPage(Hndl) and EndPage(Hndl) then it increments
properly.

I have learned that you cannot mix API and VCL calls when printing.  I used
Printers()->BeginDoc() and the StartPage(Hndl) and the IDE complained that
the printer was not currently running.  I also used StartDoc(Hndl),
StartPage(Hndl) and Printers()->Canvas->TextOut() and got the same error.
So I have to use the API calls to print, but that has lead me into another
issue.  How do you translate Printers()->Canvas->TextHeight("W") into an API
call?  Or how do you find the find and set the Font, TextHeight, and
TextWidth with API calls?

Anthony



"Remy Lebeau (TeamB)" <gambit47@yahoo.com> wrote in message
news:3f14c841$1@newsgroups.borland.com...
>
> "Anthony" <awhitesell@attbi.com> wrote in message
> news:3f1496ff@newsgroups.borland.com...
>
> > I am in the process of rewriting my routines to use
> > ::TextOut, ::MoveTo, and ::LineTo instead of
> > Canvas->TextOut, MoveTo, LineTo.
>
> What's wrong with using the TCanvas methods?
>
> > I am using Printers()->Printers->Strings[] to list the available
> > printers in a combo box to select a printer.  Is there an easy
> > way to relate the selected printer to its handle in light of the
> > current Handle issue.
>
> The TPrinter::Handle is obtain dynamically each time it is queried, it is
> not stored or reused.  If you want to get a handle then you already know
> what to do - use CreateIC/DC() or OpenPrinter() directly.
>
> >  int marker=printer_string.Pos("on");
>
> Try using " on " instead of "on" (notice the extra spaces).
>
>
> Gambit
>
>
Technical Details
Message-ID: <3f14d673$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <3f1460f3$1@newsgroups.borland.com> <3f14693d$1@newsgroups.borland.com> <3f1471c0$1@newsgroups.borland.com> <3f147649$1@newsgroups.borland.com> <3f1496ff@newsgroups.borland.com> <3f14c841$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,d59131589fe63384
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-07-15 21:40:03 PST
From: "Anthony" <awhitesell@attbi.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3f1460f3$1@newsgroups.borland.com> <3f14693d$1@newsgroups.borland.com> <3f1471c0$1@newsgroups.borland.com> <3f147649$1@newsgroups.borland.com> <3f1496ff@newsgroups.borland.com> <3f14c841$1@newsgroups.borland.com>
Subject: Re: TPrinter Problem
Date: Wed, 16 Jul 2003 00:30:21 -0400
Lines: 64
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: <3f14d673$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1058330227 24.128.134.183 (15 Jul 2003 21:37:07 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail