The PAGESETUPDLG structure contains information the PageSetupDlg function uses to initialize the Page Setup common dialog box. After the user closes the dialog box, the system returns information about the user-defined page parameters in this structure.
typedef struct tagPSD { // psd
DWORD lStructSize;
HWND hwndOwner;
HGLOBAL hDevMode;
HGLOBAL hDevNames;
DWORD Flags;
POINT ptPaperSize;
RECT rtMinMargin;
RECT rtMargin;
HINSTANCE hInstance;
LPARAM lCustData;
LPPAGESETUPHOOK lpfnPageSetupHook;
LPPAGEPAINTHOOK lpfnPagePaintHook;
LPCTSTR lpPageSetupTemplateName;
HGLOBAL hPageSetupTemplate;
} PAGESETUPDLG, * LPPAGESETUPDLG;
Members
lStructSize
Specifies the size, in bytes, of this structure.
hwndOwner
Identifies the window that owns the dialog box. This member can be any valid window handle, or it can be NULL if the dialog box has no owner.
hDevMode
Handle to a global memory object that contains a DEVMODE structure. On input, if a handle is given, the values in the corresponding DEVMODE structure are used to initialize the controls in the dialog box. On output, the dialog box sets hDevMode to a global memory handle for a DEVMODE structure that contains values specifying the user's selections. If the user's selections are not available, the dialog box sets hDevMode to NULL.
hDevNames
Handle to a global memory object that contains a DEVNAMES structure. This structure contains three strings that specify the driver name, the printer name, and the output port name. On input, if a handle is given, the strings in the corresponding DEVNAMES structure are used to initialize controls in the dialog box. On output, the dialog box sets hDevNames to a global memory handle for a DEVNAMES structure that contains strings specifying the user's selections. If the user's selections are not available, the dialog box sets hDevNames to NULL.
Flags
A set of bit flags that you can use to initialize the Page Setup common dialog box. When the dialog box returns, it sets these flags to indicate the user's input. This member can be a combination of the following flags:
PSD_DEFAULTMINMARGINS | ||||||||||||||||||||||
Sets the minimum values that the user can specify for the page margins to be the minimum margins allowed by the printer. This is the default. This flag is ignored if the PSD_MARGINS and PSD_MINMARGINS flags are also specified. | ||||||||||||||||||||||
PSD_DISABLEMARGINS | ||||||||||||||||||||||
Disables the margin controls, preventing the user from setting the margins. | ||||||||||||||||||||||
PSD_DISABLEORIENTATION | ||||||||||||||||||||||
Disables the orientation controls, preventing the user from setting the page orientation. | ||||||||||||||||||||||
PSD_DISABLEPAGEPAINTING | ||||||||||||||||||||||
Prevents the dialog box from drawing the contents of the sample page. If you enable a PagePaintHook hook procedure, you can still draw the contents of the sample page. | ||||||||||||||||||||||
PSD_DISABLEPAPER | ||||||||||||||||||||||
Disables the paper controls, preventing the user from setting page parameters such as the paper size and source. | ||||||||||||||||||||||
PSD_DISABLEPRINTER | ||||||||||||||||||||||
Disables the Printer button, preventing the user from invoking a dialog box that contains additional printer setup information. | ||||||||||||||||||||||
PSD_ENABLEPAGEPAINTHOOK | ||||||||||||||||||||||
Enables the hook procedure specified in the lpfnPagePaintHook member. | ||||||||||||||||||||||
PSD_ENABLEPAGESETUPHOOK | ||||||||||||||||||||||
Enables the hook procedure specified in the lpfnPageSetupHook member. | ||||||||||||||||||||||
PSD_ENABLEPAGESETUPTEMPLATE | ||||||||||||||||||||||
Indicates that the hInstance and lpPageSetupTemplateName members specify a dialog box template to use in place of the default template. | ||||||||||||||||||||||
PSD_ENABLEPAGESETUPTEMPLATEHANDLE | ||||||||||||||||||||||
Indicates that the hPageSetupTemplate member identifies a data block that contains a preloaded dialog box template. The system ignores the lpPageSetupTemplateName member if this flag is specified. | ||||||||||||||||||||||
PSD_INHUNDREDTHSOFMILLIMETERS | ||||||||||||||||||||||
Indicates that hundredths of millimeters are the unit of measurement for margins and paper size. The values in the rtMargin, rtMinMargin, and ptPaperSize members are in hundredths of millimeters. You can set this flag on input to override the default unit of measurement for the user's locale. When the function returns, the dialog box sets this flag to indicate the units used. | ||||||||||||||||||||||
PSD_INTHOUSANDTHSOFINCHES | ||||||||||||||||||||||
Indicates that thousandths of inches are the unit of measurement for margins and paper size. The values in the rtMargin, rtMinMargin, and ptPaperSize members are in thousandths of inches. You can set this flag on input to override the default unit of measurement for the user's locale. When the function returns, the dialog box sets this flag to indicate the units used. | ||||||||||||||||||||||
PSD_INWININIINTLMEASURE | ||||||||||||||||||||||
Not implemented. | ||||||||||||||||||||||
PSD_MARGINS | ||||||||||||||||||||||
Causes the system to use the values specified in the rtMargin member as the initial widths for the left, top, right, and bottom margins. If PSD_MARGINS is not set, the system sets the initial widths to one inch for all margins. | ||||||||||||||||||||||
PSD_MINMARGINS | ||||||||||||||||||||||
Causes the system to use the values specified in the rtMinMargin member as the minimum allowable widths for the left, top, right, and bottom margins. The system prevents the user from entering a width that is less than the specified minimum. If PSD_MINMARGINS is not specified, the system sets the minimum allowable widths to those allowed by the printer. | ||||||||||||||||||||||
PSD_NOWARNING | ||||||||||||||||||||||
Prevents the system from displaying a warning message when there is no default printer. | ||||||||||||||||||||||
PSD_RETURNDEFAULT | ||||||||||||||||||||||
PageSetupDlg does not display the dialog box. Instead, it sets the hDevNames and hDevMode members to handles to DEVMODE and DEVNAMES structures that are initialized for the system default printer. PageSetupDlg returns an error if either hDevNames or hDevMode is not NULL. | ||||||||||||||||||||||
PSD_SHOWHELP | ||||||||||||||||||||||
Causes the dialog box to display the Help button. The hwndOwner member must specify the window to receive the HELPMSGSTRING registered messages that the dialog box sends when the user clicks the Help button. |
ptPaperSize
Specifies the dimensions of the paper selected by the user. The PSD_INTHOUSANDTHSOFINCHES or PSD_INHUNDREDTHSOFMILLIMETERS flag indicates the units of measurement.
rtMinMargin
Specifies the minimum allowable widths for the left, top, right, and bottom margins. The system ignores this member if the PSD_MINMARGINS flag is not set. These values must be less than or equal to the values specified in the rtMargin member. The PSD_INTHOUSANDTHSOFINCHES or PSD_INHUNDREDTHSOFMILLIMETERS flag indicates the units of measurement.
rtMargin
Specifies the widths of the left, top, right, and bottom margins. If you set the PSD_MARGINS flag, rtMargin specifies the initial margin values. When PageSetupDlg returns, rtMargin contains the margin widths selected by the user. The PSD_INHUNDREDTHSOFMILLIMETERS or PSD_INTHOUSANDTHSOFINCHES flag indicates the units of measurement.
hInstance
If the PSD_ENABLEPAGESETUPTEMPLATE flag is set in the Flags member, hInstance is the handle of the application or module instance that contains the dialog box template named by the lpPageSetupTemplateName member.
lCustData
Specifies application-defined data that the system passes to the hook procedure identified by the lpfnPageSetupHook member. When the system sends the WM_INITDIALOG message to the hook procedure, the message's lParam parameter is a pointer to the PAGESETUPDLG structure specified when the dialog was created. The hook procedure can use this pointer to get the lCustData value.
lpfnPageSetupHook
Pointer to a PageSetupHook hook procedure that can process messages intended for the dialog box. This member is ignored unless the PSD_ENABLEPAGESETUPHOOK flag is set in the Flags member.
lpfnPagePaintHook
Pointer to a PagePaintHook hook procedure that receives WM_PSD_* messages from the dialog box whenever the sample page is redrawn. By processing the messages, the hook procedure can customize the appearance of the sample page. This member is ignored unless the PSD_ENABLEPAGEPAINTHOOK flag is set in the Flags member.
lpPageSetupTemplateName
Pointer to a null-terminated string that names the dialog box template resource in the module identified by the hInstance member. This template is substituted for the standard dialog box template. For numbered dialog box resources, lpPageSetupTemplateName can be a value returned by the MAKEINTRESOURCE macro. This member is ignored unless the PSD_ENABLEPAGESETUPTEMPLATE flag is set in the Flags member.
hPageSetupTemplate
If the PSD_ENABLEPAGESETUPTEMPLATEHANDLE flag is set in the Flags member, hPageSetupTemplate is the handle of a memory object containing a dialog box template.
Remarks
If the PSD_INHUNDREDTHSOFMILLIMETERS and PSD_INTHOUSANDTHSOFINCHES flags are not specified, the system queries the LOCALE_IMEASURE value of the default user locale to determine the unit of measure (either hundredths of millimeters or thousandths of inches) for the margin widths and paper size.
If both hDevNames and hDevMode have valid handles and the printer name specified by the wDeviceOffset member of the DEVNAMES structure is not the same as the name specified by the dmDeviceName member of the DEVMODE structure, the system uses the name specified by wDeviceOffset by default.
See Also
DEVMODE, DEVNAMES, MAKEINTRESOURCE, PagePaintHook, PageSetupDlg, PageSetupHook, WM_INITDIALOG