Article View: borland.public.cppbuilder.nativeapi
Article #12338Re: Windows Printers
From: John Scott
Date: Wed, 10 Dec 2003 23:47
Date: Wed, 10 Dec 2003 23:47
59 lines
3536 bytes
3536 bytes
I will go to my client on Monday and try it out.
Thanks for all your help
John
"Bob Gonder" <notbg@notmindspring.invalid> wrote in message
news:7c9ftvgrpm87962diqh5csq8c89lpt30p7@4ax.com...
> John Scott wrote:
> >
> >I experimented and if I used:
> > LPDEVMODE DevMode=(LPDEVMODE)GlobalLock(&ADeviceMode);
> >and: GlobalUnlock(&ADeviceMode);
> >
> >it compiled clean. Does that look correct?
>
> No. But the important question is "Does it work?"
> Try it and find out.
> Oh, and check return values for everything, too. You can use the
> ErrorBox routine I posted earlier to show the English version of
> GetLastError(), Something like
> ErrorBoxCancel(GetLastError(),"GetPrinter");
>
> This that you posted doesn't sound like what's in the vcl help, and
> the compiler is agreeing with the vcl help, not what you posted:
> >
> >DeviceMode returns the handle to a memory buffer containing a DEVMODE
> >structure, which contains device-specific initialization data for the
device
> >driver. Use the GlobalLock function to convert this handle into a pointer
to
> >the structure.
> Don't know where you got that, but it sounds like it's all wrong. So I
> now suspect it won't work that way. I don't have vcl, and never used
> it. All I can suggest if you really want to use it, is to use the
> debugger to see exactly what it returns for ADeviceMode. Dump the
> memory pointed to by the contents of ADeviceMode, and see if it looks
> like a DEVMODE structure.
>
> If it fails, fall back to my original suggestion (this *is* the API
> group after all).
>
> I think there's some way to get the proper printer handle out of
> TPrinter.
>
> num_bytes = DocumentProperties(NULL, printerHandle, &printer_name,
> NULL, NULL, 0);
> DevMode = (DEVMODE*)GlobalAlloc( GMEM_FIXED|GMEM_ZEROINIT,num_bytes);
> DocumentProperties(NULL, printerHandle, &printer_name, DevMode,
> NULL, DM_OUT_BUFFER);
>
> DevMode.dmDuplex = DMDUP_VERTICAL;
> DevMode.dmFields = DM_DUPLEX;
>
> DocumentProperties(NULL, printerHandle, &printer_name, DevMode,
> DevMode, DM_OUT_BUFFER | DM_IN_BUFFER);
> {...}
> GlobalFree(DevMode);
>
>
Technical Details
Message-ID:
<3fd7b0c7@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<goumsvolftvangoh1n8i7ktptavi57ut2d@4ax.com> <dsvmsvo53afn3qqk6p2ir6ld5lldimucju@4ax.com> <3fcb93d8@newsgroups.borland.com> <eipnsvs99q92prau97tl685lua6crv6e92@4ax.com> <3fce1fed@newsgroups.borland.com> <eudssvci6j3q0l82ivvfs5oj3i2rn1c5ct@4ax.com> <3fcf5268$1@newsgroups.borland.com> <3fd4b3a4@newsgroups.borland.com> <tvr9tv4cctvuri7np179a37t666i9m1s5u@4ax.com> <3fd5ece9@newsgroups.borland.com> <r2jctvg3ob96k02d4lmdh0td3eascnm0bt@4ax.com> <3fd74ac6@newsgroups.borland.com> <7c9ftvgrpm87962diqh5csq8c89lpt30p7@4ax.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-10 16:09:41 PST From: "John Scott" <jscott@kw.igs.net> Newsgroups: borland.public.cppbuilder.nativeapi References: <goumsvolftvangoh1n8i7ktptavi57ut2d@4ax.com> <dsvmsvo53afn3qqk6p2ir6ld5lldimucju@4ax.com> <3fcb93d8@newsgroups.borland.com> <eipnsvs99q92prau97tl685lua6crv6e92@4ax.com> <3fce1fed@newsgroups.borland.com> <eudssvci6j3q0l82ivvfs5oj3i2rn1c5ct@4ax.com> <3fcf5268$1@newsgroups.borland.com> <3fd4b3a4@newsgroups.borland.com> <tvr9tv4cctvuri7np179a37t666i9m1s5u@4ax.com> <3fd5ece9@newsgroups.borland.com> <r2jctvg3ob96k02d4lmdh0td3eascnm0bt@4ax.com> <3fd74ac6@newsgroups.borland.com> <7c9ftvgrpm87962diqh5csq8c89lpt30p7@4ax.com> Subject: Re: Windows Printers Date: Wed, 10 Dec 2003 18:47:11 -0500 Lines: 61 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: 216.16.227.117 Message-ID: <3fd7b0c7@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1071100103 216.16.227.117 (10 Dec 2003 15:48:23 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail