Article View: borland.public.cppbuilder.nativeapi
Article #15133Re: TPrinter Problem
From: Anthony
Date: Wed, 16 Jul 2003 12:48
Date: Wed, 16 Jul 2003 12:48
75 lines
3389 bytes
3389 bytes
Unfortunately, I must say that somehow something is different because they
do two different things.
This is how I get the handle (Hndl) that I am passing to the API calls.
char cDevice[256];
char cDriver[256];
char cPort[256];
THandle hDeviceMode;
HANDLE HPrinter;
Printer()->PrinterIndex = index;
Printer()->GetPrinter(cDevice, cDriver, cPort, hDeviceMode );
HDC Hndl= CreateDC(NULL, cDevice, NULL, NULL);
I am doing the following to print on consecutive "1 inch pages":
OpenPrinter(Hndl, &di);
StartDoc(Hndl);
StartPage(Hndl);
::TextOut(Hndl, ...);
EndPage(Hndl);
EndDoc(Hndl);
ClosePrinter(Hndl);
Whereas the following here skips "10 pages" between printing:
Printers()->PrinterIndex=x;
Printers()->BeginDoc();
Printers()->Canvas->TextOut();
Printers()->EndDoc();
Any thoughts?
-Anthony
"Remy Lebeau (TeamB)" <gambit47@yahoo.com> wrote in message
news:3f14eafa@newsgroups.borland.com...
>
> "Anthony" <awhitesell@attbi.com> wrote in message
> news:3f14d673$1@newsgroups.borland.com...
>
> > 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.
>
> That is the same thing that TPrinter:NewPage() does internally:
>
> procedure TPrinter.NewPage;
> begin
> CheckPrinting(True);
> EndPage(DC);
> StartPage(DC);
> Inc(FPageNumber);
> Canvas.Refresh;
> end;
>
> > 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.
>
> Which handle are you actually passing to StartPage() in the first place?
> Everytime you talk about issues with coding, please ALWAYS post the actual
> code in question.
>
> > How do you translate Printers()->Canvas->TextHeight("W")
> > into an API call?
>
> TextHeight() call TextExtent() which in turn uses the API function
> GetTextExtentPoint32().
>
>
> Gambit
>
>
Technical Details
Message-ID:
<3f154b45@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<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> <3f14d673$1@newsgroups.borland.com> <3f14eafa@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-16 06:13:18 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> <3f14d673$1@newsgroups.borland.com> <3f14eafa@newsgroups.borland.com> Subject: Re: TPrinter Problem Date: Wed, 16 Jul 2003 08:48:41 -0400 Lines: 77 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: <3f154b45@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1058360133 24.128.134.183 (16 Jul 2003 05:55:33 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail