🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: TPrinter Problem

#15108
From: Anthony
Date: Wed, 16 Jul 2003 00:08
59 lines
3396 bytes
Alan,

Unfortunately, although the HDC value is the same the content is also the
same.  This is confirmed by the page size not changing as the PrinterIndex
is changed.

I used TPrinter because I had a comprehensive example that fit my
application.  I have started to change the code over API calls.  I now need
to find how to get a list of devices from the API that is similar to
Printers()->Printers->Strings[] in the VCL so the operator can choose the
printer or a way to get from Printers()->Printers->Strings[] to the Device
name so I can call OpenPrinter(Device, &HPrinter, NULL) reliably.  Do you
have any solutions for this latest dilemma?

TIA.
Anthony


"Alan Bellingham" <alanb@episys.com> wrote in message
news:qgq8hv4fn52ds00n5hv0602s8hfm6lksbv@4ax.com...
> "Remy Lebeau \(TeamB\)" <gambit47@yahoo.com> wrote:
>
> >"Anthony" <awhitesell@attbi.com> wrote in message
> >news:3f1460f3$1@newsgroups.borland.com...
> >
> >> my_hdc1, my_hdc2, my_hdc3, my_hdc4 are all same.  Meaning that you
cannot
> >> get the handle of any printer other than the handle to the default
> >printer.
> >> What use is this?  How do you get the handle of a printer other than
the
> >> default?
> >
> >Call the Win32 API CreateIC() function directly.  Check if it is doing
the
> >same thing.  If it is, then there is nothing TPrinter can do about it,
the
> >OS itself is returning the wrong HDC in the first place.  CreateIC() is
the
> >function that is uses to get the HDC for each printer.
>
> And there's a possibility that, though the value is the same, that the
> content isn't.
>
> It wouldn't surprise me to find the HDC being released back to Windows
> when the next printer is indexed, and Windows then generating a new DC
> in the same place for the new handle.
>
> The whole concept of using the Printer object is not one I've tried - my
> printer code is all written using the underlying API, with
> DocumentProperties() and OpenPrinter() and ResetDC() and the like. I
> suspect that the Printer object is fine for simple use (printing
> reports, say), but may be a little limited for advanced usage.
>
> Alan Bellingham
> --
> Me <url:mailto:alanb@episys.com> <url:http://www.doughnut.demon.co.uk/>
> ACCU - C, C++ and Java programming               <url:http://accu.org/>
> The 2004 Discworld Convention                   <url:http://dwcon.org/>
Technical Details
Message-ID: <3f149911$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!newsfeed.online.be!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> <qgq8hv4fn52ds00n5hv0602s8hfm6lksbv@4ax.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 17:39:53 PST
From: "Anthony" <awhitesell@attbi.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3f1460f3$1@newsgroups.borland.com> <3f14693d$1@newsgroups.borland.com> <qgq8hv4fn52ds00n5hv0602s8hfm6lksbv@4ax.com>
Subject: Re: TPrinter Problem
Date: Tue, 15 Jul 2003 20:08:29 -0400
Lines: 61
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: <3f149911$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1058314513 24.128.134.183 (15 Jul 2003 17:15:13 -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!newsfeed.online.be!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail