Article View: borland.public.cppbuilder.nativeapi
Article #1660Re: More on Dialogs
From: Remy Lebeau (TeamB)
Date: Wed, 27 Jun 2007 16:37
Date: Wed, 27 Jun 2007 16:37
40 lines
2304 bytes
2304 bytes
"JD" <nospam@nospam.com> wrote in message
news:46825ff3@newsgroups.borland.com...
> 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.
If you look at the source code for TPrinterSetupDialog and
TPrintDialog, you can see how they both use the DEVMODE and DEVNAMES
structures to set the PrinterIndex. Both dialogs call the
TPrinter::SetPrinter() method. For example (translated from the
dialog source code):
void __fastcall SetPrinter(HANDLE DeviceMode, HANDLE DeviceNames)
{
DEVNAMES *DevNames = (DEVNAMES*) GlobalLock(DeviceNames);
try
{
Printer()->SetPrinter(
((char*)DevNames) + DevNames->wDeviceOffset,
((char*)DevNames) + DevNames->wDriverOffset,
((char*)DevNames) + DevNames->wOutputOffset,
(int)DeviceMode);
}
__finally
{
GlobalUnlock(DeviceNames);
GlobalFree(DeviceNames);
// TPrinter takes ownership of the DeviceMode so do not
free it...
}
}
Gambit
Technical Details
Message-ID:
<46829422$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newshub.sdsu.edu!tethys.csu.net!ucberkeley!news-hog.berkeley.edu!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<46825ff3@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,964b3d9a83e56201 X-Google-Attributes: gid10cc67,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <46825ff3@newsgroups.borland.com> Subject: Re: More on Dialogs Date: Wed, 27 Jun 2007 09:37:18 -0700 Lines: 42 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 NNTP-Posting-Host: 75.82.252.126 Message-ID: <46829422$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1182962722 75.82.252.126 (27 Jun 2007 09:45:22 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newshub.sdsu.edu!tethys.csu.net!ucberkeley!news-hog.berkeley.edu!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail