Article View: borland.public.cppbuilder.nativeapi
Article #1656More on Dialogs
From: JD
Date: Wed, 27 Jun 2007 13:02
Date: Wed, 27 Jun 2007 13:02
28 lines
1953 bytes
1953 bytes
TPrinterSetupDialog and TPrintDialog will set the TPrinter's
PrinterIndex. Other dialogs such as PageSetupDlg, PrintDlg and
PrintDlgEx do not (duh ... they're win32 APIs) but they do
return a DEVMODE and DEVNAMES struct that one can use to get
the name of the printer but I have a problem with both structs.
The DEVMODE has a dmDeviceName member which is defined as:
BCHAR dmDeviceName[CCHDEVICENAME];
Specifies the the "friendly" name of the printer; for
example, "PCL/HP LaserJet" in the case of PCL/HP
LaserJet๏ฟฝ. This string is unique among device drivers.
Note that this name may be truncated to fit in the
dmDeviceName array.
and CCHDEVICENAME is 32. Similarly, the DEVNAMES related
member is also 32 bytes long.
I went back and looked at some old BCB5 code to verify that I
was recalling correctly that 32 bytes isn't enough for the
names listed in TPrinter's Printers and I found where I had
noted a change from saving 50 characters for the printer name
to 100 because TPrinter::Printers::IndexOf was failing.
So, How does one get the same names that TPrinter uses?
~ JD
Technical Details
Message-ID:
<46825ff3@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,964b3d9a83e56201,start X-Google-Attributes: gid10cc67,public,usenet X-Google-Language: ENGLISH,ASCII Reply-To: "JD" <nospam@nospam.com> From: "JD" <nospam@nospam.com> Newsgroups: borland.public.cppbuilder.nativeapi Subject: More on Dialogs Date: Wed, 27 Jun 2007 08:02:40 -0500 Lines: 30 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2869 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 NNTP-Posting-Host: 172.162.201.161 Message-ID: <46825ff3@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1182949363 172.162.201.161 (27 Jun 2007 06:02:43 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail