Article View: borland.public.cppbuilder.nativeapi
Article #7834Re: Printer properties
From: Keith
Date: Thu, 16 Dec 2004 14:27
Date: Thu, 16 Dec 2004 14:27
57 lines
2865 bytes
2865 bytes
"Thomas J." wrote:
> Oh sorry I used to work with the VCL. It would be great if you could send me
> a code snippet how to open the dialog.
>
> My code snippet is not working. Thanks for your help
>
> LPPAGESETUPDLG pageSetup;
> bool result = PageSetupDlg(pageSetup);
> if (result) {
> MessageDlg("Ok", mtInformation, TMsgDlgButtons() << mbOK, 0);
> } else {
> MessageDlg("Error", mtError, TMsgDlgButtons() << mbOK, 0);
> }
>
> PRINTDLG printerSetup;
> result = PrintDlg(&printerSetup);
> if (result) {
> MessageDlg("Ok", mtInformation, TMsgDlgButtons() << mbOK, 0);
> } else {
> MessageDlg("Error", mtError, TMsgDlgButtons() << mbOK, 0);
> }
>
There are a few things missing from your example:
LPPAGESETUPDLG pageSetup;
pageSetup=new PAGESETUPDLG; // create a new structure
ZeroMemory(pageSetup,sizeof(PAGESETUPDLG)); // clear it out
pageSetup->lStructSize=sizeof(PAGESETUPDLG); // set the structure size
pageSetup->hwndOwner=Handle; // and owner handle
bool result = PageSetupDlg(pageSetup);
if (result) {
MessageDlg("Ok", mtInformation, TMsgDlgButtons() << mbOK, 0);
} else {
MessageDlg("Error", mtError, TMsgDlgButtons() << mbOK, 0);
}
delete pageSetup; // delete it when you are through using it.
PRINTDLG printerSetup;
ZeroMemory(&printerSetup,sizeof(PRINTDLG)); // clear out this local structure
variable
printerSetup.lStructSize=sizeof(PRINTDLG); // set the structure length
printerSetup.hwndOwner=Handle; // and owner handle
result = PrintDlg(&printerSetup);
if (result) {
MessageDlg("Ok", mtInformation, TMsgDlgButtons() << mbOK, 0);
} else {
MessageDlg("Error", mtError, TMsgDlgButtons() << mbOK, 0);
}
keith
Technical Details
Message-ID:
<41C19B3E.7A34D7BA@sbcglobal.net>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!transit.nntp.hccnet.nl!transit1.nntp.hccnet.nl!border2.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<41bfe84c$1@newsgroups.borland.com> <6ro0s0pgsjn6kr7lnhkb68gtfkr2g0glm2@4ax.com> <41c162f7@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,6620db7697e43cb9 X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit Message-ID: <41C19B3E.7A34D7BA@sbcglobal.net> Date: Thu, 16 Dec 2004 08:27:10 -0600 From: Keith <kdopson@sbcglobal.net> X-Mailer: Mozilla 4.79 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: Printer properties References: <41bfe84c$1@newsgroups.borland.com> <6ro0s0pgsjn6kr7lnhkb68gtfkr2g0glm2@4ax.com> <41c162f7@newsgroups.borland.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 65.71.227.85 X-Trace: newsgroups.borland.com 1103207231 65.71.227.85 (16 Dec 2004 06:27:11 -0800) Lines: 59 Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!transit.nntp.hccnet.nl!transit1.nntp.hccnet.nl!border2.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail