Поделиться через


CPageSetupDialog::DoModal

Call this function to display the Windows common OLE Page Setup dialog box and allow the user to select various print setup options such as the printing margins, size and orientation of the paper, and destination printer.

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

In addition, the user can access the printer setup options such as network location and properties specific to the selected printer.

If you want to initialize the various Page Setup dialog options by setting members of the m_psd structure, you should do so before calling DoModal, and after the dialog object is constructed. After calling DoModal, call other member functions to retrieve the settings or information input by the user into the dialog box.

If you want to propagate the current settings entered by the user, make a call to CWinApp::SelectPrinter. This function takes the information from the CPageSetupDialog object and initializes and selects a new printer DC with the proper attributes.

AfxGetApp()->SelectPrinter(psd.m_psd.hDevNames, psd.m_psd.hDevMode);

Example

See the example for CPageSetupDialog::CPageSetupDialog.

Requirements

Header: afxdlgs.h

See Also

Reference

CPageSetupDialog Class

Hierarchy Chart

CPageSetupDialog::m_psd

Other Resources

CPageSetupDialog Members