Article View: borland.public.cppbuilder.nativeapi
Article #12420Re: Windows Printers
From: Bob Gonder
Date: Wed, 03 Dec 2003 19:32
Date: Wed, 03 Dec 2003 19:32
40 lines
3018 bytes
3018 bytes
John Scott wrote:
>I am getting ready to try it this way. I am having a problem assigning the
>value to the dmDuplex value in the DEVMODE structure. The following code
>gives me an error Pointer to structure required on left side of -> or ->*
>
> char ADevice[256]={0}, ADriver[256]={0}, APort[256]={0};
> THandle ADeviceMode;
> Printer()->GetPrinter(ADevice, ADriver, APort, ADeviceMode);
I have no idea what GetPrinter() does (I don't do VCL), but it is
obvious that ADeviceMode is a THandle, not a DEVMODE.
AS I posted before, you need to use DocumentProperties() or the VCL
equiv. to get/set the devmode.
num_bytes = DocumentProperties(NULL, printerHandle, &printerfile_port,
NULL, NULL, 0);
DevMode = (DEVMODE*)GlobalAlloc( GMEM_FIXED |GMEM_ZEROINIT,num_bytes);
DocumentProperties(NULL, printerHandle, &printerfile_port, DevMode,
NULL, DM_OUT_BUFFER);
// modify the appropriate fields
DevMode->dmFields = DM_ORIENTATION | DM_PRINTQUALITY ;
DevMode->dmOrientation = printer_direction=='L'? DMORIENT_LANDSCAPE:
DMORIENT_PORTRAIT;
DevMode->dmPrintQuality = DMRES_HIGH;
// call DocumentProperties() yet again, this time to get the
final DEVMODE to pass into the CreateDC() function
DocumentProperties(NULL, printerHandle, &printerfile_port, DevMode,
DevMode, DM_OUT_BUFFER | DM_IN_BUFFER);
// create a printer device context
printerDC = CreateDC( NULL/*Driver.c_str()*/, &printerfile_port, NULL,
DevMode);
GlobalFree(DevMode);
>One final thing how does Printer()->NewPage; differ from the StartPage() and
>EndPage()?
Don't know, but it probably calls them.
Technical Details
Message-ID:
<eudssvci6j3q0l82ivvfs5oj3i2rn1c5ct@4ax.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<3fbcf9c2@newsgroups.borland.com> <3fbd8132$1@newsgroups.borland.com> <3fc77301@newsgroups.borland.com> <3fc7e524$1@newsgroups.borland.com> <3fca2474@newsgroups.borland.com> <3fcb2567$1@newsgroups.borland.com> <3fcb6984@newsgroups.borland.com> <goumsvolftvangoh1n8i7ktptavi57ut2d@4ax.com> <dsvmsvo53afn3qqk6p2ir6ld5lldimucju@4ax.com> <3fcb93d8@newsgroups.borland.com> <eipnsvs99q92prau97tl685lua6crv6e92@4ax.com> <3fce1fed@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,7b2449597708bec X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-12-03 11:40:14 PST From: Bob Gonder <notbg@notmindspring.invalid> Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: Windows Printers Date: Wed, 03 Dec 2003 11:32:14 -0800 Organization: MindSpring Enterprises, Inc. Reply-To: notbg@notmindspring.invalid Message-ID: <eudssvci6j3q0l82ivvfs5oj3i2rn1c5ct@4ax.com> References: <3fbcf9c2@newsgroups.borland.com> <3fbd8132$1@newsgroups.borland.com> <3fc77301@newsgroups.borland.com> <3fc7e524$1@newsgroups.borland.com> <3fca2474@newsgroups.borland.com> <3fcb2567$1@newsgroups.borland.com> <3fcb6984@newsgroups.borland.com> <goumsvolftvangoh1n8i7ktptavi57ut2d@4ax.com> <dsvmsvo53afn3qqk6p2ir6ld5lldimucju@4ax.com> <3fcb93d8@newsgroups.borland.com> <eipnsvs99q92prau97tl685lua6crv6e92@4ax.com> <3fce1fed@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.113 X-Trace: newsgroups.borland.com 1070479937 67.31.165.113 (3 Dec 2003 11:32:17 -0700) Lines: 42 Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail