PrintDlg

This function displays a Print or Print Setup dialog box. The Print dialog box enables the user to specify the properties of a particular print job.

For Windows CE versions 2.10 and later, this function has been replaced by the PageSetupDlg function.

BOOL PrintDlg(
LPPRINTDLG lppd);

Parameters

  • lppd
    Long pointer to a PRINTDLG structure that contains information used to initialize the dialog box. When PrintDlg returns, this structure contains information about the users selections.

Return Values

If the user clicks the OK button, the return value is nonzero. The members of the PRINTDLG structure pointed to by the lppd parameter indicate the users selections.

If the user canceled or closed the Print or Printer Setup dialog box or an error occurred, the return value is zero. To get extended error information, use the CommDlgExtendedError function. If the user canceled or closed the dialog box, CommDlgExtendedError returns zero; otherwise, it returns one of the following values:

CDERR_FINDRESFAILURE PDERR_CREATEICFAILURE
CDERR_INITIALIZATION PDERR_DEFAULTDIFFERENT
CDERR_LOADRESFAILURE PDERR_DNDMMISMATCH
CDERR_LOADSTRFAILURE PDERR_GETDEVMODEFAIL
CDERR_LOCKRESFAILURE PDERR_INITFAILURE
CDERR_MEMALLOCFAILURE PDERR_LOADDRVFAILURE
CDERR_MEMLOCKFAILURE PDERR_NODEFAULTPRN
CDERR_NOHINSTANCE PDERR_NODEVICES
CDERR_NOHOOK PDERR_PARSEFAILURE
CDERR_NOTEMPLATE PDERR_PRINTERNOTFOUND
CDERR_STRUCTSIZE PDERR_RETDEFFAILURE

Remarks

If the hook procedure (pointed to by the lpfnPrintHook member of the PRINTDLG structure) processes the WM_CTLCOLORDLG message, the hook procedure must return a handle for the brush that should be used to paint the control background.

Calling PrintDlg with dwFlags equal to PD_RETURNDEFAULTDC causes the function to use the last-saved settings or the default settings. This can cause PrintDlg to fail if the settings are not valid. You should use the manual PrintDlg—that is, without the PD_RETURNDEFAULTDC—to choose a valid printer, port, or other destination to ensure that you can print to it.

When you are done with the device context (DC) returned by PrintDlg, call the DeleteDC function to delete it.

Requirements

Runs On Versions Defined in Include Link to
Windows CE OS 2.0 and 2.01 Commdlg.h   Commdlg.lib

Note   This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.

See Also

CommDlgExtendedError, CreateDC, DeleteDC, PrintHookProc, StartDoc, WM_CTLCOLORDLG, PageSetupDlg, PAGESETUPDLG, PRINTDLG

 Last updated on Tuesday, July 13, 2004

© 1992-2000 Microsoft Corporation. All rights reserved.