Article View: borland.public.cppbuilder.nativeapi
Article #15106Re: TPrinter Problem
From: Anthony
Date: Wed, 16 Jul 2003 00:29
Date: Wed, 16 Jul 2003 00:29
54 lines
3115 bytes
3115 bytes
JD has reminded me of the solution:
char Device[ 256 ] = { 0 };
char Driver[ 256 ] = { 0 };
char Port[ 256 ] = { 0 };
THandle hDeviceMode;
Printer()->PrinterIndex = pIndex;
Printer()->GetPrinter( Device, Driver, Port, hDeviceMode );
Thanx.
"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:
<3f149e01$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-05!sn-xit-09!supernews.com!64.152.100.70.MISMATCH!sjc70.webusenet.com!news.webusenet.com!cyclone.bc.net!logbridge.uoregon.edu!xmission!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<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:29:33 -0400 Lines: 56 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: <3f149e01$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1058315777 24.128.134.183 (15 Jul 2003 17:36:17 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-05!sn-xit-09!supernews.com!64.152.100.70.MISMATCH!sjc70.webusenet.com!news.webusenet.com!cyclone.bc.net!logbridge.uoregon.edu!xmission!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail