Compartilhar via


PAGESETUPDLG (structure)

Other versions of this page are also available for the following:

Windows Mobile Not SupportedWindows Embedded CE Supported

8/28/2008

This structure contains information used by PageSetupDlg (function) to initialize the Page Setup common dialog box.

For Windows CE 2.10 and later, this structure replaces PRINTDLG (structure).

Syntax

typedef struct tagPSD { 
  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
    Handle to 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
    Set of bit flags that you can use to initialize the PageSetup common dialog box. When the dialog box returns, it sets these flags to indicate the user's input. It can be a combination of the following flags.
  • Value Description

    PSD_DEFAULTMINMARGINS

    Not supported.

    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

    Not supported.

    PSD_DISABLEPAPER

    Disables the paper controls, preventing the user from setting page parameters such as the paper size and source.

    PSD_DISABLEPRINTRANGE

    In Windows Embedded CE, this flag disables the Print Range group box of the dialog box.

    PSD_DISABLEPRINTER

    Disables the Printer button, preventing the user from invoking a dialog box that contains additional printer setup information.

    PSD_ENABLEPAGEPAINTHOOK

    Not supported.

    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 supported.

    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_NONETWORKBUTTON

    Not supported.

    PSD_NOWARNING

    Not supported.

    PSD_RANGESELECTION

    In Windows Embedded CE, this flag sets the Selection button on the dialog box as the default print range. If PSD_RANGESELECTION is not set, the print range is set to the All button.

    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

    Not supported.

  • ptPaperSize
    Not supported.
  • 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 to 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
    Long 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
    Not supported.
  • lpPageSetupTemplateName
    Long 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 to a memory object that contains a dialog box template.

Remarks

After the user closes the dialog box, the system returns information about the user-defined page members in this structure.

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.

The PageSetupDlg function fills the DEVNAMES structure with byte offsets rather than the expected character offsets.

Requirements

Header commdlg.h
Windows Embedded CE Windows CE 2.10 and later

See Also

Reference

PageSetupDlg (function)
PageSetupHook
WM_INITDIALOG
DEVNAMES
DEVMODE
MAKEINTRESOURCE
PRINTDLG (structure)