Overview
The SetDefaultPrintLayout
function is part of the ComDlg32.dll library and is used to establish the default printing layout for applications that utilize the common dialog boxes for printing. This function allows developers to pre-configure settings like page orientation, paper size, and margins, providing a consistent printing experience for users.
This function is particularly useful for applications that need to enforce specific printing standards or simplify the user's interaction with the print dialog by pre-selecting common or preferred layout options.
Syntax
BOOL SetDefaultPrintLayout( const PRINTLAYOUTEX * pPrintLayout );
The BOOL
type is a boolean value that returns TRUE
if the function succeeds, and FALSE
otherwise. For extended error information, call GetLastError
.
Parameters
pPrintLayout
-
A pointer to a
PRINTLAYOUTEX
structure. This structure contains information that defines the default print layout, including:dwSize
: The size of the structure in bytes.dwFlags
: Flags that specify how the print layout should be applied.ptPaperSize
: The size of the paper in twips (1/20th of a point).rcMargin
: The margins in twips.iOrientation
: The page orientation (portrait or landscape).iScale
: The scaling factor for the page content (e.g., 1000 for 100%).- ... and other relevant layout settings.
For a detailed description of the
PRINTLAYOUTEX
structure members, please refer to the PRINTLAYOUTEX Structure Documentation.
Return Value
BOOL
TRUE
if the function successfully sets the default print layout. FALSE
if the function fails. To get specific error information, call GetLastError
.
Possible error codes include:
ERROR_INVALID_PARAMETER
: ThepPrintLayout
pointer is invalid or the structure members are not properly initialized.ERROR_NOT_SUPPORTED
: The requested print layout settings are not supported by the system or the current printer driver.
Requirements
Minimum supported client | Windows 2000 Professional |
Minimum supported server | Windows 2000 Server |
Header | commdlg.h |
Library | Comdlg32.lib |
DLL | Comdlg32.dll |