🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Windows Printers (Bob Gonder please respond)

#12176
From: Bob Gonder
Date: Thu, 18 Dec 2003 17:18
27 lines
2150 bytes
John Scott wrote:

>One question - The &printerfile_port parameter in the DocumentProperties() -
>what data type is this, the help for OpenPrinter seems to say it is
>    LPTSTR pPrinterName, // pointer to printer or server name
>I can get the printer name from the
>Printer()->Printers->Strings[PrinterIndex] object as a TString data type,
>this is not a null terminated array of char, but I can convert it if
>necessary. How should I declare the printerfile_port variable?

It is the name of the printer as it appears under
Start/Settings/Printers. It can be listed using EnumPrinters.

It's a normal zero terminated char array.
	char	pPrinterName[] = "Generic Text Printer";
or
	char*	pPrinterName = new char[256];

lstrcpy(pPrinterName,Printer()->Printers->Strings[PrinterIndex].cstr();
or

char*pPrinterName=strdup(Printer()->Printers->Strings[PrinterIndex].cstr());
	use it
	free(pPrinterName);
Or you can just use the ASCII String portion of the Tstring directly.

DocumentProperties(NULL,PrinterHandle,Printer()->Printers->Strings[PrinterIndex].cstr(),NULL,NULL,0);
Technical Details
Message-ID: <tcn3uv4kgreqdscbecbni9njs777j097t7@4ax.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <3fdf3f3b@newsgroups.borland.com> <lb1vtv00s6mqf5mlqkraou7v3rir2lvlcr@4ax.com> <3fe1c62b@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,db79f85f5b525ea6
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-12-18 09:40:25 PST
From: Bob Gonder <notbg@notmindspring.invalid>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: Windows Printers (Bob Gonder please respond)
Date: Thu, 18 Dec 2003 09:18:32 -0800
Organization: MindSpring Enterprises, Inc.
Reply-To: notbg@notmindspring.invalid
Message-ID: <tcn3uv4kgreqdscbecbni9njs777j097t7@4ax.com>
References: <3fdf3f3b@newsgroups.borland.com> <lb1vtv00s6mqf5mlqkraou7v3rir2lvlcr@4ax.com> <3fe1c62b@newsgroups.borland.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: 67.31.165.59
X-Trace: newsgroups.borland.com 1071767913 67.31.165.59 (18 Dec 2003 09:18:33 -0700)
Lines: 29
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail