Compartilhar via


PRINTDLG (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 PrintDlg (function) uses to initialize the Print common dialog box. After a user closes the dialog box, the system uses this structure to return information about the user's print option selections.

For Windows CE 2.10 and later, this structure has been replaced by PAGESETUPDLG (structure).

Syntax

typedef struct tagPD {
  DWORD cbStruct;
  HWND hwndOwner;
  HDC hdc;
  DWORD dwFlags;
  RECT rcMinMargin;
  RECT rcMargin;
  HINSTANCE hinst;
  LPARAM lCustData;
  LPPRINTHOOKPROC pfnPrintHook;
  LPCTSTR pszPrintTemplateName;
  HGLOBAL hglbPrintTemplateResource;
} PRINTDLG , *LPPRINTDLG;

Members

  • cbStruct
    Specifies the structure size, in bytes.
  • 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.
  • hdc
    When PrintDlg returns, hdc contains the handle to the device context of the printer.
  • dwFlags
    Specifies a bitmask of flags used to initialize the Print 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

    PD_SELECTALLPAGES

    On input, this flag causes the All radio button to be selected when the dialog box is created. On output, it indicates that the user selected the All radio button.

    PD_SELECTSELECTION

    On input, this flag causes the Selection radio button to be in the selected state when the dialog box is created. On output, it indicates that the user selected the Selection radio button. If this flag is not specified, the All radio button is selected by default.

    PD_SELECTDRAFTMODE

    Indicates the user selected the Draft mode check box.

    PD_SELECTA4

    Indicates the user selected A4 size paper.

    PD_SELECTLETTER

    Indicates the user selected letter size paper.

    PD_SELECTINFRARED

    Indicates the user selected the infrared printer port.

    PD_SELECTSERIAL

    Indicates the user selected the serial printer port.

    PD_DISABLEPAPERSIZE

    Disables paper size selection.

    PD_DISABLEPRINTRANGE

    Disables print range selection.

    PD_DISABLEMARGINS

    Disables margin selection.

    PD_DISABLEORIENTATION

    Disables page orientation selection.

    PD_RETURNDEFAULTDC

    Returns the device context (DC) of the default printer without displaying the dialog.

    PD_ENABLEPRINTHOOK

    Enables the hook procedure specified in the pfnPrintHook member. This enables the hook procedure for the Print dialog box.

    PD_ENABLEPRINTTEMPLATE

    Indicates that the hinst and pszPrintTemplateName members specify a dialog box template to use in place of the default template for the Print dialog box.

    PD_ENABLEPRINTTEMPLATEHANDLE

    Indicates that the hglbPrintTemplateResource member identifies a data block that contains a preloaded dialog box template. The system uses this template in place of the default template for the Print dialog box. The system ignores the pszPrintTemplateName member if this flag is specified.

    PD_SELECTPORTRAIT

    On input, this flag specifies the Print dialog box should be initialized with Portrait orientation selected as the default. On output, this flag indicates that the user selected Portrait orientation.

    PD_SELECTLANDSCAPE

    On input, this flag specifies the Print dialog box should be initialized with Landscape orientation selected as the default. On output, this flag indicates the user selected Landscape orientation.

    PD_MARGINS

    On input, this flag specifies that the rcMargin member contains initial margin values. On output, it indicates that the rcMargin member contains user-specified margin values.

     

    If this flag is not specified, the Print dialog box uses the default margins, which are 1 inch for the top and bottom margins and 1.25 inches for the left and right margins.

    PD_INTHOUSANDTHSOFINCHES

    Indicates the unit of measure in which margins are specified. If neither this flag nor the PD_INHUNDREDTHSOFMILLIMETERS flag is specified, the Print dialog box uses the LOCALE_IMEASURE setting in the locale table to determine whether to use the U.S. system of measurements or the metric system.

    PD_INHUNDREDTHSOFMILLIMETERS

    Indicates the unit of measure in which margins are specified. If neither this flag nor the PD_INHUNDREDTHSOFMILLIMETERS flag is specified, the Print dialog box uses the LOCALE_IMEASURE setting in the locale table to determine whether to use the U.S. system of measurements or the metric system.

    PD_MINMARGINS

    On input, this flag specifies that the rcMinMargin member contains initial minimum margin values. On output it indicates that the rcMinMargin member contains user-specified minimum margin values. If the value in the rcMinMargin member is zero on output, it means the user did not specify any minimum margin values.

  • rcMargin
    Specifies the widths of the left, top, right, and bottom margins. If you set the PSD_MARGINS flag, rcMargin specifies the initial margin values. When PrintDlg returns, rcMargin contains the margin widths selected by the user. The PSD_INHUNDREDTHSOFMILLIMETERS or PSD_INTHOUSANDTHSOFINCHES flag indicates the units of measurement.
  • rcMinMargin
    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 rcMargin member. The PSD_INTHOUSANDTHSOFINCHES or PSD_INHUNDREDTHSOFMILLIMETERS flag indicates the units of measurement.
  • hinst
    Handle to the application or module instance that contains the dialog box template named by the pszPrintTemplateName member. This member is only valid if the PD_ENABLEPRINTTEMPLATE or PD_ENABLESETUPTEMPLATE flag is set in the dwFlags member.
  • lCustData
    Specifies application-defined data that the system passes to the hook procedure identified by the pfnPrintHook member. When the system sends the WM_INITDIALOG message to the hook procedure, the message's lParam parameter is a pointer to the PRINTDLG structure specified when the dialog was created. The hook procedure can use this pointer to get the lCustData value.
  • pfnPrintHook
    Pointer to a PrintHookProc hook procedure that can process messages intended for the Print dialog box. This member is ignored unless the PD_ENABLEPRINTHOOK flag is set in the Flags member.
  • pszPrintTemplateName
    Pointer to a null-terminated string that names a dialog box template resource in the module identified by the hinst member. This template is substituted for the standard Print dialog box template. This member is ignored unless the PD_ENABLEPRINTTEMPLATE flag is set in the Flags member.
  • hglbPrintTemplateResource
    If the PD_ENABLEPRINTTEMPLATEHANDLE flag is set in the Flags member, hglbPrintTemplateResource is the handle to a memory object that contains a dialog box template. This template is substituted for the standard Print dialog box template.

Remarks

If the application does not specify the paper orientation, the Print dialog box reads the last paper orientation the user selected, which it saved to the registry. If there is no value in the registry, the dialog box selects portrait as the default. The dialog box also uses the last printer, port, and paper size the user selected. If these values are not in the registry, the dialog box selects the first printer, first port, and a paper size that is appropriate for the regional setting as the defaults.

Requirements

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

See Also

Reference

PrintDlg (function)
PrintHookProc
PAGESETUPDLG (structure)
WM_INITDIALOG