🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #13360

Re: can't start print dialog box

#13360
From: Richard Yu
Date: Fri, 17 Oct 2003 16:38
45 lines
2298 bytes
It's ok now with following code
HRESULT hResult;
        LPPRINTDLGEX pPDX = NULL;
        LPPRINTPAGERANGE pPageRanges = NULL;

        pPDX = (LPPRINTDLGEX)GlobalAlloc(GPTR, sizeof(PRINTDLGEX));
        if (!pPDX)
        {
        //
        }

        pPageRanges = (LPPRINTPAGERANGE) GlobalAlloc(GPTR,
                          10 * sizeof(PRINTPAGERANGE));
        if (!pPageRanges)
        {
        //
        }

        pPDX->lStructSize = sizeof(PRINTDLGEX);
        pPDX->hwndOwner = GetDesktopWindow();;//hWnd;
        pPDX->hDevMode = NULL;
        pPDX->hDevNames = NULL;
        pPDX->hDC = NULL;
        pPDX->Flags = PD_RETURNDC | PD_COLLATE;
        pPDX->Flags2 = 0;
        pPDX->ExclusionFlags = 0;
        pPDX->nPageRanges = 0;
        pPDX->nMaxPageRanges = 10;
        pPDX->lpPageRanges = pPageRanges;
        pPDX->nMinPage = 1;
        pPDX->nMaxPage = 1000;
        pPDX->nCopies = 1;
        pPDX->hInstance = 0;
        pPDX->lpPrintTemplateName = NULL;
        pPDX->lpCallback = NULL;
        pPDX->nPropertyPages = 0;
        pPDX->lphPropertyPages = NULL;
        pPDX->nStartPage = START_PAGE_GENERAL;
        pPDX->dwResultAction = 0;

        hResult = PrintDlgEx(pPDX);

and the hResult= S_OK

thanks guys!
Technical Details
Message-ID: <3f901b2f$1@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-mail
References: <3f8f1905$1@newsgroups.borland.com> <3f8f1c4f$1@newsgroups.borland.com> <3f8f2eb2@newsgroups.borland.com> <3f8f3efc$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,517b17f45791657
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-10-17 09:40:12 PST
From: "Richard Yu" <richard@colorselector.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3f8f1905$1@newsgroups.borland.com> <3f8f1c4f$1@newsgroups.borland.com> <3f8f2eb2@newsgroups.borland.com> <3f8f3efc$1@newsgroups.borland.com>
Subject: Re: can't start print dialog box 
Date: Fri, 17 Oct 2003 09:38:16 -0700
Lines: 47
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4522.1200
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200
NNTP-Posting-Host: 24.207.7.224
Message-ID: <3f901b2f$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1066408751 24.207.7.224 (17 Oct 2003 09:39:11 -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