Platforms to show: All Mac Windows Linux Cross-Platform

Back to WindowsPrintDialogMBS class.

WindowsPrintDialogMBS.Constructor

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Printing MBS Win Plugin 12.1 ❌ No ✅ Yes ❌ No ❌ No Desktop only
The constructor.

WindowsPrintDialogMBS.GetDevNames(byref DriverName as string, byref DeviceName as string, byref OutputName as string, byref flags as Integer) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Printing MBS Win Plugin 12.1 ❌ No ✅ Yes ❌ No ❌ No Desktop only
Queries the strings that identify the driver, device, and output port names for a printer.

Returns true if values are available and false if not.

DriverName: The file name (without the extension) of the device driver. On input, this string is used to determine the printer to display initially in the dialog box.
OutputName: The device name for the physical output medium (output port).
Flags: Indicates whether the strings here identify the default printer. This string is used to verify that the default printer has not changed since the last print operation. If any of the strings do not match, a warning message is displayed informing the user that the document may need to be reformatted. On output, the Flags member is changed only if the Print Setup dialog box was displayed and the user chose the OK button. The DN_DEFAULTPRN flag is used if the default printer was selected. If a specific printer is selected, the flag is not used. All other flags in this member are reserved for internal use by the dialog box procedure for the Print property sheet or Print dialog box.

WindowsPrintDialogMBS.getPageRange(index as Integer, byref fromPage as Integer, byref toPage as Integer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Printing MBS Win Plugin 12.1 ❌ No ✅ Yes ❌ No ❌ No Desktop only
Queries a page range entry.

WindowsPrintDialogMBS.PrintDialog as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Printing MBS Win Plugin 12.1 ❌ No ✅ Yes ❌ No ❌ No Desktop only
Displays a Print Dialog Box or a Print Setup dialog box.

The Print dialog box enables the user to specify the properties of a particular print job.

If the user clicks the OK button, the return value is true. The members of the object indicate the user's selections.

If the user canceled or closed the Print or Printer Setup dialog box or an error occurred, the return value is zero. To get extended error information, use the lasterror property. If the user canceled or closed the dialog box, lasterror returns zero.

This is the older function. PrintDialogEx is the newer function.
see also
http://msdn.microsoft.com/en-us/library/windows/desktop/ms646940(v=vs.85).aspx

WindowsPrintDialogMBS.PrintDialogEx as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Printing MBS Win Plugin 12.1 ❌ No ✅ Yes ❌ No ❌ No Desktop only
Displays a Print property sheet that enables the user to specify the properties of a particular print job.

Changed from Boolean to Integer in v21.3 to allow you to distinguish between different different results. Result is either 0 for OK or an COM error code.

A Print property sheet has a General page that contains controls similar to the Print dialog box. The property sheet can also have additional application-specific and driver-specific property pages as well as the General page.
If the function succeeds, the return value is S_OK (0) and the ResultAction member contains one of the following values.

ConstantValueDescription
PD_RESULT_APPLY2The user clicked the Apply button and later clicked the Cancel button. This indicates that the user wants to apply the changes made in the property sheet, but does not yet want to print. The WindowsPrintDialogMBS contains the information specified by the user at the time the Apply button was clicked.
PD_RESULT_CANCEL0The user clicked the Cancel button. The information in the WindowsPrintDialogMBS is unchanged.
PD_RESULT_PRINT1The user clicked the Print button. The WindowsPrintDialogMBS contains the information specified by the user.

Lasterror is set.
The values of DevMode and DevNames in WindowsPrintDialogMBS may change when they are passed into PrintDialog. This is because these members are filled on both input and output.
If PD_RETURNDC is set but PD_USEDEVMODECOPIESANDCOLLATE flag is not set, the PrintDialog functions return incorrect number of copies. To get the correct number of copies, ensure that the calling application always uses PD_USEDEVMODECOPIESANDCOLLATE with PD_RETURNDC.

see also
http://msdn.microsoft.com/en-us/library/windows/desktop/ms646942(v=vs.85).aspx

Some examples using this method:

WindowsPrintDialogMBS.SetDevNames(DriverName as string, DeviceName as string, OutputName as string, flags as Integer) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Printing MBS Win Plugin 12.1 ❌ No ✅ Yes ❌ No ❌ No Desktop only
Sets the strings that identify the driver, device, and output port names for a printer.

Returns true on success and false on failure.

DriverName: The file name (without the extension) of the device driver. On input, this string is used to determine the printer to display initially in the dialog box.
OutputName: The device name for the physical output medium (output port).
Flags: Indicates whether the strings here identify the default printer. This string is used to verify that the default printer has not changed since the last print operation. If any of the strings do not match, a warning message is displayed informing the user that the document may need to be reformatted. On output, the Flags member is changed only if the Print Setup dialog box was displayed and the user chose the OK button. The DN_DEFAULTPRN flag is used if the default printer was selected. If a specific printer is selected, the flag is not used. All other flags in this member are reserved for internal use by the dialog box procedure for the Print property sheet or Print dialog box.

WindowsPrintDialogMBS.setPageRange(index as Integer, fromPage as Integer, toPage as Integer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Printing MBS Win Plugin 12.1 ❌ No ✅ Yes ❌ No ❌ No Desktop only
Sets a page range entry.

Index from 0 to 19.

The items on this page are in the following plugins: MBS Win Plugin.


The biggest plugin in space...