🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Using Windows printer with standard iostreams

#15859
From: Nick B. Cassos
Date: Tue, 10 Jun 2003 13:14
46 lines
2962 bytes
On Tue, 10 Jun 2003 11:55:30 +0100, Alisdair Meredith
<alisdair.meredith@uk.renaultf1.com> wrote:

>"Nick B. Cassos" wrote:
>
>> For local printers, you can specify LPTx or COMx as the filename. For
>> network printers you can specify the "\\Server\Share" syntax...
>
>Excellent tip, thank you <g>
>
>Unfortunately, I can't seem to extract the Printer Share Names from our
>environment.
>
>I tried the GetPrinter WinAPI, but all printers come back with an empty
>share name.
>

You need to use WNetOpenEnum()/WNetEnumResource() to get the printer
shares.

>This was supposed to be a quick-and-dirty print solution for us...

Believe me, its easier than you think. You may even succeed in setting
your app to work with this even if there is no provision for filename
like ports. If you can specify something like LPTx in your app then
you can make use of Windows port capturing so that you print in, say,
LPT5 and all you data actually go to wherever a printer is. I repeat,
this is optional and should only be used whenever a specification like
\\Server\Share, directly in the app level, is not possible.

Of course, direct printing to the printer ports should only be used
for ascii like data, even coupled with special escape codes. Over the
years, I have tested more than 40 different printers of various
manufacturers and technologies. I haven't met one that does not
support ascii printing. Some brands makes out life more easy than
this, by offering epson/ibm escape codes compatibility. In other
words, some inkjets or lasers can work like a real dot-matrix.

If you, or anyone else is interested in WNetOpenEnum code or a
function that can print directly to a printer making use of an ascii
template, I can post some code.

-- 

Nick B. Cassos
http://www.flenik.com
Technical Details
Message-ID: <bclbev8pkdj42lfgj16opq30frigotvf59@4ax.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!sn-xit-09!supernews.com!wn14feed!wn13feed!worldnet.att.net!216.166.71.14!border3.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <3EE4B2B4.DE5AB2AA@uk.renaultf1.com> <cmj9ev0bqfmeo0tst2huh4d1n3bgfkvsmv@4ax.com> <3EE5B922.5F14E714@uk.renaultf1.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,a2c54bfae5b2c76c
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-06-10 06:32:05 PST
From: Nick B. Cassos <nbc@no_spam.ath.forthnet.gr>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: Using Windows printer with standard iostreams
Date: Tue, 10 Jun 2003 16:14:25 +0300
Message-ID: <bclbev8pkdj42lfgj16opq30frigotvf59@4ax.com>
References: <3EE4B2B4.DE5AB2AA@uk.renaultf1.com> <cmj9ev0bqfmeo0tst2huh4d1n3bgfkvsmv@4ax.com> <3EE5B922.5F14E714@uk.renaultf1.com>
X-Newsreader: Forte Agent 1.93/32.576 English (American)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 213.16.150.22
X-Trace: newsgroups.borland.com 1055250879 213.16.150.22 (10 Jun 2003 06:14:39 -0700)
Lines: 46
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!sn-xit-09!supernews.com!wn14feed!wn13feed!worldnet.att.net!216.166.71.14!border3.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail