Udostępnij za pośrednictwem


CPrintDialog::DoModal

Displays the Windows common print dialog box and allows the user to select various printing options such as the number of copies, page range, and whether copies should be collated.

virtual INT_PTR DoModal( );

Return Value

IDOK or IDCANCEL. If IDCANCEL is returned, call the Windows CommDlgExtendedError function to determine whether an error occurred.

IDOK and IDCANCEL are constants that indicate whether the user selected the OK or Cancel button.

Remarks

If you want to initialize the various print dialog options by setting members of the m_pd structure, you should do this before calling DoModal, but after the dialog object is constructed.

After calling DoModal, you can call other member functions to retrieve the settings or information input by the user into the dialog box.

Note that when you call the constructor with bPrintSetupOnly set to FALSE, the PD_RETURNDC flag is automatically used. After calling DoModal, GetDefaults, or GetPrinterDC, a printer DC will be returned in m_pd.hDC. This DC must be freed with a call to DeleteDC by the caller of CPrintDialog.

Example

See the example for CPrintDialog::CreatePrinterDC.

Requirements

Header: afxdlgs.h

See Also

Reference

CPrintDialog Class

Hierarchy Chart

CPrintDialog::CPrintDialog

CDialog::DoModal

Other Resources

CPrintDialog Members