Compartilhar via


PageSetupDlg function

Creates a Page Setup dialog box that enables the user to specify the attributes of a printed page. These attributes include the paper size and source, the page orientation (portrait or landscape), and the width of the page margins.

Syntax

BOOL WINAPI PageSetupDlg(
  _Inout_ LPPAGESETUPDLG lppsd
);

Parameters

  • lppsd [in, out]
    Type: LPPAGESETUPDLG

    A pointer to a PAGESETUPDLG structure that contains information used to initialize the dialog box. The structure receives information about the user's selections when the function returns.

Return value

Type: BOOL

If the user clicks the OK button, the return value is nonzero. The members of the PAGESETUPDLG structure pointed to by the lppsd parameter indicate the user's selections.

If the user cancels or closes the Page Setup dialog box or an error occurs, the return value is zero. To get extended error information, use the CommDlgExtendedError function

Note that the values of hDevMode and hDevNames in PAGESETUPDLG may change when they are passed into PageSetupDlg. This is because these members are filled on both input and output.

Remarks

Starting with Windows Vista, the PageSetupDlg does not contain the Printer button. To switch printer selection, use PrintDlg or PrintDlgEx.

Examples

For an example, see Setting Up the Printed Page.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Commdlg.h (include Windows.h)

Library

Comdlg32.lib

DLL

Comdlg32.dll

Unicode and ANSI names

PageSetupDlgW (Unicode) and PageSetupDlgA (ANSI)

See also

Reference

CommDlgExtendedError

PagePaintHook

PAGESETUPDLG

PageSetupHook

Conceptual

Common Dialog Box Library