🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: TPrinter Problem

#15104
From: Anthony
Date: Tue, 15 Jul 2003 23:59
53 lines
2887 bytes
Gambit,

I am in the process of rewriting my routines to use ::TextOut, ::MoveTo, and
::LineTo instead of Canvas->TextOut, MoveTo, LineTo.

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.

I was using the following but will not work properly if someone has the word
"on" in their printer name (like Canon).  This is an issue because
Printers()->Printers->Strings[] has the Device name and port in the same
string (ie "Canon BJC-250 on LPT1:")

 AnsiString printer_string =
Printer()->Printers->Strings[fSelectPreEntryLabelPrinter->cbPreEntryLabelPri
nter->ItemIndex];
 int marker=printer_string.Pos("on");
 Device = printer_string.SubString(1, marker-1);
  // open the printer
 HANDLE HPrinter;
 if (OpenPrinter(Device.c_str(), &HPrinter, NULL))
 { ...}

TIA.
Anthony

"Remy Lebeau (TeamB)" <gambit47@yahoo.com> wrote in message
news:3f147649$1@newsgroups.borland.com...
>
> "Anthony" <awhitesell@attbi.com> wrote in message
> news:3f1471c0$1@newsgroups.borland.com...
>
> > I can use both
> >
> >    HDC HPrinterDC = CreateDC(NULL, Device.c_str(), NULL, pdm);
> > and
> >    HDC HPrinterDC = CreateIC(NULL, Device.c_str(), NULL, pdm);
>
> I didn't say to use CreateDC().  That is a different matter.
>
> > and get the correct page sizes.
>
> What does page sizes have to do with anything?  You said you were
receiving
> the same HDC when using Printer()->Handle?  Or did I misread what you said
> originally?  Please clearify EXACTLY what you are trying to do and what
> EXACTLY is not working correctly.
>
>
> Gambit
>
>
Technical Details
Message-ID: <3f1496ff@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!news.tele.dk!news.tele.dk!small.news.tele.dk!npeer.de.kpn-eurorings.net!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>

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:09:37 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>
Subject: Re: TPrinter Problem
Date: Tue, 15 Jul 2003 19:59:38 -0400
Lines: 55
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: <3f1496ff@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1058313983 24.128.134.183 (15 Jul 2003 17:06:23 -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!news.tele.dk!news.tele.dk!small.news.tele.dk!npeer.de.kpn-eurorings.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail