PageSetupDlg Function
The PageSetupDlg function displays the Windows Page Setup dialog box. This dialog box enables the user to set various page formatting options, such as paper size, paper source, and orientation.
BOOL PageSetupDlg(LPPSH PAGE_SETUP_STRUCT);
Parameters
PAGE_SETUP_STRUCT
- [in, out] A pointer to a
PSHPAGE_SETUP_STRUCT
structure that contains information used to initialize the dialog box and receive the user's input.
Return Value
- If the user clicks the OK button, the return value is nonzero.
- If the user cancels or closes the dialog box, the return value is zero.
- If an error occurs, the return value is zero. To get extended error information, call GetLastError.
Remarks
The Page Setup dialog box allows the user to select:
- Paper size and source.
- Page orientation (portrait or landscape).
- Margins for the page.
The application can set default values for these options by filling in the members of the PSHPAGE_SETUP_STRUCT
structure before calling PageSetupDlg. The structure can also contain a handle to a HPROPSHEETPAGE
structure that the application can use to add custom pages to the dialog box.
After PageSetupDlg returns, the application can retrieve the user's selections from the PSHPAGE_SETUP_STRUCT
structure. The rtMargins
member will contain the selected margins, and the ptPaperSize
member will contain the selected paper dimensions.
Structure
The following structure is used by the PageSetupDlg function:
PSHPAGE_SETUP_STRUCT
typedef struct tagPSHPAGE_SETUP_STRUCT {
DWORD dwSize; // Size of the structure in bytes.
HWND hwndOwner; // Handle to the owner window.
HMODULE hDevMode; // Handle to a DEVMODE structure.
HMODULE hDevNames; // Handle to a DEVNAMES structure.
DWORD Flags; // Optional flags.
LONG nMinMargin[2]; // Minimum margin values.
LONG nMaxMargin[2]; // Maximum margin values.
LONG rcMargin[4]; // Initial margin values.
LONG rtMargin[4]; // User-selected margin values.
LPARAM lParam; // Application-defined value.
LPFNPSPCALLBACK pfnSetupHook; // Pointer to a hook function.
LPWSTR pszSetupTitle; // Title for the dialog box.
HANDLE hPageSetupHook; // Handle to the Page Setup hook procedure.
LPPROPSHEETPAGE pPageRanges; // Pointer to an array of PAGE_SETUP_STRUCT structures.
DWORD nMaxPageRanges; // Maximum number of PAGE_SETUP_STRUCT structures.
DWORD nMinPage; // Minimum page number.
DWORD nMaxPage; // Maximum page number.
DWORD nCurPage; // Current page number.
} PSHPAGE_SETUP_STRUCT, FAR *LPPSHPAGE_SETUP_STRUCT;
Requirements
Component | Version |
---|---|
Header | ComDlg32.h |
Library | Comdlg32.lib |
DLL | Comdlg32.dll |
PrintDocumentPackage.CreatePrintPackageFromPrintTicket
and related methods for managing print settings.