Xojo Conferences
MBSOct2019CologneDE

Platforms to show: All Mac Windows Linux Cross-Platform

WindowsPrinterMBS.AddForm(form as WindowsPageFormatMBS) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Printing MBS Win Plugin 12.1 No Yes No Yes, Windows only No
Function: The AddForm function adds a form to the list of available forms that can be selected for the specified printer.
Example:
// query default printer
dim w as new WindowsPrinterMBS(WindowsPrinterMBS.GetDefaultPrinter)

dim form as new WindowsPageFormatMBS

form.Mode = 1
form.Name = "MyTest"
form.DisplayName = "MyTest"
form.Flags = 0
form.SizeHeight = 100000
form.SizeWidth = 100000
form.ImageableAreaLeft = 0
form.ImageableAreaTop = 0
form.ImageableAreaRight = 100000
form.ImageableAreaBottom = 100000

if w.AddForm(form) then
MsgBox "OK"
else
MsgBox "Failed"
end if
Notes:
Form.Mode gives level of the data. Must be either 1 (old version) or 2 (newer version).

Form: The form details.

Returns true if the function succeeds and false if the function fails.

Note: This is a blocking or synchronous function and might not return immediately. How quickly this function returns depends on run-time factors such as network status, print server configuration, and printer driver implementation—factors that are difficult to predict when writing an application. Calling this function from a thread that manages interaction with the user interface could make the application appear to be unresponsive.

An application can determine which forms are available for a printer by calling the GetPrinterFormats function.
If form points to a Mode 2 form, then AddForm will fail if either a form with the specified name already exists or the Keyword value already exists.

Feedback, Comments & Corrections

WindowsPrinterMBS.AdvancedDocumentProperties(InputDevMode as WindowsDeviceModeMBS, byref OutputDevMode as WindowsDeviceModeMBS, parent as window = nil) as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Printing MBS Win Plugin 12.1 No Yes No No No
Function: Displays a printer-configuration dialog box for the specified printer, allowing the user to configure that printer.
Notes:
This function is a special case of the DocumentProperties function.

parent: The parent window of the printer-configuration dialog box.

OutputDevMode: The device mode structure that will contain the configuration data specified by the user.
InputDevMode: The device mode structure that contains the configuration data used to initialize the controls of the printer-configuration dialog box.

If the DocumentProperties function with these parameters is successful, the return value of AdvancedDocumentProperties is 1. Otherwise, the return value is zero.

This is a blocking or synchronous function and might not return immediately. How quickly this function returns depends on run-time factors such as network status, print server configuration, and printer driver implementation—factors that are difficult to predict when writing an application. Calling this function from a thread that manages interaction with the user interface could make the application appear to be unresponsive.

This function can only display the printer-configuration dialog box so a user can configure it. For more control, use DocumentProperties.

Feedback, Comments & Corrections

WindowsPrinterMBS.AllJobs as WindowsPrinterJobMBS()
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Printing MBS Win Plugin 12.1 No Yes No Yes, Windows only No
Function: Queries all jobs for the printer.
Example:
dim w as new WindowsPrinterMBS( WindowsPrinterMBS.GetDefaultPrinter)
dim jobs() as WindowsPrinterJobMBS = w.AllJobs
MsgBox str(UBound(jobs)+1)+" jobs"
Notes: PrinterName property must be set, so the function knows which printer.

Feedback, Comments & Corrections

WindowsPrinterMBS.CanPrinterPassThroughPostScript as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Printing MBS Win Plugin 12.1 No Yes No Yes, Windows only No
Function: Whether this printer can pass through postscript data.
Notes:
Returns true for Postscript printers and false for other printers.

For more information on this function, visit this website:
http://msdn.microsoft.com/en-us/library/dd162831(v=VS.85).aspx

Feedback, Comments & Corrections

WindowsPrinterMBS.ChangePrinterSettings(value as WindowsDeviceModeMBS, Mode as Integer=2) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Printing MBS Win Plugin 12.1 No Yes No Yes, Windows only No
Function: Changes printer settings.
Notes:
This function opens the printer, queries current settings using GetPrinter, applies all your changes, calls DocumentProperties to verify those settings are valid for the printer and uses SetPrinter to apply the changes.
To indicate which fiels in the WindowsDeviceModeMBS object are set by you, use the fields integer value with a combination of the DM_* constants.
Returns true on success and false on failure.

Mode can be 2 (general printer information), 8 (global settings) or 9 (user settings).

For more information on the GetPrinter function, check this website:
http://msdn.microsoft.com/en-us/library/dd144911(VS.85).aspx

For more information on the SetPrinter function, check this website:
http://msdn.microsoft.com/en-us/library/dd145082(VS.85).aspx

For more information on the DocumentProperties function, check this website:
http://msdn.microsoft.com/en-us/library/dd183576(VS.85).aspx

Even if you change printer settings, other parts of the application, e.g. Xojo framework may not care.

Feedback, Comments & Corrections

WindowsPrinterMBS.ConfigurePort(name as string = "", parent as window = nil, PortName as string = "") as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Printing MBS Win Plugin 12.1 No Yes No No No
Function: Displays the port-configuration dialog box for a port on the specified server.
Notes:
Name: The name of the server on which the specified port exists. If this parameter is "", the port is local.
parent: The parent window of the port-configuration dialog box.
PortName: The name of the port to be configured.

Returns true on success and false on failure.

This is a blocking or synchronous function and might not return immediately. How quickly this function returns depends on run-time factors such as network status, print server configuration, and printer driver implementation—factors that are difficult to predict when writing an application. Calling this function from a thread that manages interaction with the user interface could make the application appear to be unresponsive.

Before calling the ConfigurePort function, an application should call the EnumPorts function to determine valid port names.

Feedback, Comments & Corrections

WindowsPrinterMBS.ConnectToPrinterDialog(parent as window = nil) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Printing MBS Win Plugin 12.1 No Yes No No No
Function: Displays a dialog box that lets users browse and connect to printers on a network.
Notes:
If the user selects a printer, the function attempts to create a connection to it; if a suitable driver is not installed on the server, the user is given the option of creating a printer locally.

parent: Specifies the parent window of the dialog box.

If the function succeeds and the user selects a printer, this object points to the new printer and return value is true.
If the function fails, or the user cancels the dialog box without selecting a printer, the return value is true.

This is a blocking or synchronous function and might not return immediately. How quickly this function returns depends on run-time factors such as network status, print server configuration, and printer driver implementation—factors that are difficult to predict when writing an application. Calling this function from a thread that manages interaction with the user interface could make the application appear to be unresponsive.

The ConnectToPrinterDialog function attempts to create a connection to the selected printer. However, if the server on which the printer resides does not have a suitable driver installed, the function offers the user the option of creating a printer locally.

An application should call DeletePrinter to delete a local printer. An application should call DeletePrinterConnection to delete a connection to a printer.

Feedback, Comments & Corrections

WindowsPrinterMBS.Constructor(PrinterName as string, admin as boolean = false)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Printing MBS Win Plugin 12.1 No Yes No Yes, Windows only No
Function: Opens the printer so you can operate on it.
Notes:
Admin: whether you want to get permissions to administrate.
Raises exception if printer can't be opened. Use OpenPrinter function to avoid exception.

Feedback, Comments & Corrections

WindowsPrinterMBS.DeleteForm(name as string) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Printing MBS Win Plugin 12.1 No Yes No Yes, Windows only No
Function: The DeleteForm function removes a form name from the list of supported forms.
Notes:
name: The form name to be removed.

Returns true on success and false on failure.

This is a blocking or synchronous function and might not return immediately. How quickly this function returns depends on run-time factors such as network status, print server configuration, and printer driver implementation—factors that are difficult to predict when writing an application. Calling this function from a thread that manages interaction with the user interface could make the application appear to be unresponsive.

DeleteForm can only delete form names that were added by using the AddForm function.

Feedback, Comments & Corrections

WindowsPrinterMBS.DeleteJob(JobID as Integer) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Printing MBS Win Plugin 12.1 No Yes No Yes, Windows only No
Function: Delete the print job.
Notes: Returns true on success and false on failure.

Feedback, Comments & Corrections

WindowsPrinterMBS.DeletePrinter as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Printing MBS Win Plugin 12.1 No Yes No Yes, Windows only No
Function: Deletes the specified printer object.
Notes:
Returns true on success and false on failure.

This is a blocking or synchronous function and might not return immediately. How quickly this function returns depends on run-time factors such as network status, print server configuration, and printer driver implementation—factors that are difficult to predict when writing an application. Calling this function from a thread that manages interaction with the user interface could make the application appear to be unresponsive.

If there are print jobs remaining to be processed for the specified printer, DeletePrinter marks the printer for pending deletion, and then deletes it when all the print jobs have been printed. No print jobs can be added to a printer that is marked for pending deletion.
A printer marked for pending deletion cannot be held, but its print jobs can be held, resumed, and restarted. If the printer is held and there are jobs for the printer, DeletePrinter fails with ERROR_ACCESS_DENIED.

Lasterror is set.

Feedback, Comments & Corrections

WindowsPrinterMBS.DocumentProperties(InputDevMode as WindowsDeviceModeMBS, byref OutputDevMode as WindowsDeviceModeMBS, Prompt as boolean = false, parent as window = nil) as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Printing MBS Win Plugin 12.1 No Yes No No No
Function: The DocumentProperties function retrieves or modifies printer initialization information or displays a printer-configuration property sheet for the specified printer.
Example:
// get default printer
dim p as WindowsPrinterMBS = WindowsPrinterMBS.OpenPrinter(WindowsPrinterMBS.GetDefaultPrinter)

// ask for printer settings
dim s as new WindowsDeviceModeMBS
dim n as Integer = p.DocumentProperties(nil, s, true, window1)
Notes:
Printername property must be set.

parent: The parent window of the printer-configuration property sheet. Can be nil.
Prompt: Whether to show dialog.

OutputDevMode: Devmode variable that receives the printer configuration data specified by the user.
InputDevMode: Optional input data which the operating system uses to initialize the property sheet controls.
Prompt: Whether the function presents the printer driver's Print Setup property sheet and then changes the settings in the printer's DeviceMode data structure to those values specified by the user.

If you provide object for InputDevMode, the function will read settings from there. If you don't pass an object (nil) or you pass incomplete settings, default settings are used to complete.
If prompt is true, the dialog is shown and user can change settings.
On the end, the current new data is stored in OutputDevMode where you can find it.

If the function displays the property sheet, the return value is either IDOK (1) or IDCANCEL (2), depending on which button the user selects.
If the function does not display the property sheet and is successful, the return value is IDOK (1).
If the function fails, the return value is less than zero.

This is a blocking or synchronous function and might not return immediately. How quickly this function returns depends on run-time factors such as network status, print server configuration, and printer driver implementation-factors that are difficult to predict when writing an application. Calling this function from a thread that manages interaction with the user interface could make the application appear to be unresponsive.

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

Feedback, Comments & Corrections

WindowsPrinterMBS.GetForm(name as string) as WindowsPageFormatMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Printing MBS Win Plugin 12.1 No Yes No Yes, Windows only No
Function: The GetForm function retrieves information about a specified form.
Example:
// query default printer
dim w as new WindowsPrinterMBS(WindowsPrinterMBS.GetDefaultPrinter)

// get a page format
dim f as WindowsPageFormatMBS = w.GetForm("Letter")

// and show details
MsgBox f.DisplayName+" "+str(F.SizeWidth/10000,"0.0")+" x "+str(f.SizeHeight/10000,"0.0")
Notes:
name: The string that specifies the name of the form. To get the names of the forms supported by the printer, call the GetPrinterFormats function.

On failure returns nil, on success the form details.

This is a blocking or synchronous function and might not return immediately. How quickly this function returns depends on run-time factors such as network status, print server configuration, and printer driver implementation—factors that are difficult to predict when writing an application. Calling this function from a thread that manages interaction with the user interface could make the application appear to be unresponsive.

If the caller is remote, and the Form Mode is 2, the StringType value of the returned WindowsPageFormatMBS will always be STRING_LANGPAIR.

Feedback, Comments & Corrections

WindowsPrinterMBS.GetJob(JobID as Integer) as WindowsPrinterJobMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Printing MBS Win Plugin 12.1 No Yes No Yes, Windows only No
Function: Query job with given ID from printer.
Notes:
Returns nil on any error.
PrinterName property must be set, so the function knows which printer.

Feedback, Comments & Corrections

WindowsPrinterMBS.GetPrinterFormats as WindowsPageFormatMBS()
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Printing MBS Win Plugin 12.1 No Yes No Yes, Windows only No
Function: Queries the page formats supported by this printer.
Notes:
On failure the array is empty.

This function uses the EnumForms for which you can find more information on this website:
http://msdn.microsoft.com/en-us/library/dd162624(v=VS.85).aspx

Feedback, Comments & Corrections

WindowsPrinterMBS.GetPrinterSettings(Mode as Integer=2) as WindowsDeviceModeMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Printing MBS Win Plugin 12.1 No Yes No Yes, Windows only No
Function: Queries printer settings.
Example:
dim w as new WindowsPrinterMBS(WindowsPrinterMBS.GetDefaultPrinter)
dim dm as WindowsDeviceModeMBS = w.GetPrinterSettings
Notes:
Mode can be 2 (general printer information), 8 (global settings) or 9 (user settings).

For more information on the GetPrinter function, check this website:
http://msdn.microsoft.com/en-us/library/dd144911(VS.85).aspx

Feedback, Comments & Corrections

WindowsPrinterMBS.GetPrinterTechnology as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Printing MBS Win Plugin 10.4 No Yes No Yes, Windows only No
Function: Queries the printer technology.
Example:
dim w as new WindowsPrinterMBS("my printer")
msgbox w.GetPrinterTechnology
Notes:
Opens the printer, queries the print technology and returns that string.
For postscript printers the string should contain the word "postscript".
Returns an empty string on any error.

For details on this function, check the following website:
http://msdn.microsoft.com/en-us/library/dd144931(VS.85).aspx

Feedback, Comments & Corrections

WindowsPrinterMBS.PauseJob(JobID as Integer) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Printing MBS Win Plugin 12.1 No Yes No Yes, Windows only No
Function: Pause the print job.
Notes: Returns true on success and false on failure.

Feedback, Comments & Corrections

WindowsPrinterMBS.PausePrinter as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Printing MBS Win Plugin 12.1 No Yes No Yes, Windows only No
Function: Pauses the printer.
Example:
dim name as string = WindowsPrinterMBS.GetDefaultPrinter
dim p as WindowsPrinterMBS = WindowsPrinterMBS.OpenPrinter(name, true)

if p.PausePrinter then
MsgBox "OK"
else
MsgBox "Failed: "+p.LasterrorMessage+" "+str(p.Lasterror)
end if
Notes:
Requires application to be run by administrator and printer opened with admin option. Else you get error 5.
Returns true on success and false on failure.

Feedback, Comments & Corrections

WindowsPrinterMBS.PrinterProperties(parent as window = nil) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Printing MBS Win Plugin 12.1 No Yes No No No
Function: The PrinterProperties function displays a printer-properties property sheet for the specified printer.
Example:
// get default printer
dim w as new WindowsPrinterMBS(WindowsPrinterMBS.GetDefaultPrinter)

// open properties dialog
if w.PrinterProperties(window1) then
MsgBox "OK"
else
MsgBox "Failed"
end if
Notes:
Returns true on success (dialog shows) or false on error.
Parent is the parent window for the new dialog. Can be nil.

Feedback, Comments & Corrections

WindowsPrinterMBS.PurgePrinter as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Printing MBS Win Plugin 12.1 No Yes No Yes, Windows only No
Function: Purges the printer.
Example:
dim name as string = WindowsPrinterMBS.GetDefaultPrinter
dim p as WindowsPrinterMBS = WindowsPrinterMBS.OpenPrinter(name, true)

if p.PurgePrinter then
MsgBox "OK"
else
MsgBox "Failed: "+p.LasterrorMessage+" "+str(p.Lasterror)
end if
Notes:
Requires application to be run by administrator and printer opened with admin option. Else you get error 5.
Returns true on success and false on failure.

Feedback, Comments & Corrections

WindowsPrinterMBS.ResumeJob(JobID as Integer) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Printing MBS Win Plugin 12.1 No Yes No Yes, Windows only No
Function: Resume a paused print job.
Notes: Returns true on success and false on failure.

Feedback, Comments & Corrections

WindowsPrinterMBS.ResumePrinter as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Printing MBS Win Plugin 12.1 No Yes No Yes, Windows only No
Function: Resumes the printer.
Example:
dim name as string = WindowsPrinterMBS.GetDefaultPrinter
dim p as WindowsPrinterMBS = WindowsPrinterMBS.OpenPrinter(name, true)

if p.ResumePrinter then
MsgBox "OK"
else
MsgBox "Failed: "+p.LasterrorMessage+" "+str(p.Lasterror)
end if
Notes:
Requires application to be run by administrator and printer opened with admin option. Else you get error 5.
Returns true on success and false on failure.

Feedback, Comments & Corrections

WindowsPrinterMBS.SetForm(name as string, form as WindowsPageFormatMBS) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Printing MBS Win Plugin 12.1 No Yes No Yes, Windows only No
Function: The SetForm function sets the form information for the specified printer.
Notes:
name: The string that specifies the form name for which the form information is set.
Form: The form data. Mode property must be either 1 (older format) or 2 (newer format).

Returns true on success and false on failure.

This is a blocking or synchronous function and might not return immediately. How quickly this function returns depends on run-time factors such as network status, print server configuration, and printer driver implementation—factors that are difficult to predict when writing an application. Calling this function from a thread that manages interaction with the user interface could make the application appear to be unresponsive.

SetForm can be called multiple times for an existing WindowsPageFormatMBS, each call adding additional pairs of DisplayName and LangId values. All languages versions of the form will get the Size and ImageableArea values of the WindowsPageFormatMBS in the most recent call to SetForm.
If the caller is remote and the form's Mode is 2, the StringType value of the WindowsPageFormatMBS cannot be STRING_MUIDLL.

Feedback, Comments & Corrections

WindowsPrinterMBS.SetJob(JobID as Integer, job as WindowsPrinterJobMBS) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Printing MBS Win Plugin 12.4 No Yes No Yes, Windows only No
Function: Sets job parameters.
Example:
dim w as new WindowsPrinterMBS( WindowsPrinterMBS.GetDefaultPrinter, true)
dim jobs() as WindowsPrinterJobMBS = w.AllJobs
MsgBox str(UBound(jobs)+1)+" jobs"

// pick first
dim j as WindowsPrinterJobMBS = jobs(0)
j.Document = "Hello World"

// write back values
call w.SetJob(j.JobID, j)

// error?
if w.Lasterror<>0 then
MsgBox w.LasterrorMessage
end if
Notes:
see also
http://msdn.microsoft.com/en-us/library/windows/desktop/dd162978(v=vs.85).aspx

Feedback, Comments & Corrections

WindowsPrinterMBS.SetPrinterSettings(value as WindowsDeviceModeMBS, Mode as Integer=2) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Printing MBS Win Plugin 12.1 No Yes No Yes, Windows only No
Function: Sets printer settings.
Example:
// switch default printer to A5 landscape paper

dim name as string = WindowsPrinterMBS.GetDefaultPrinter
dim p as WindowsPrinterMBS = WindowsPrinterMBS.OpenPrinter(name, false)
dim d as WindowsDeviceModeMBS = p.GetPrinterSettings(9)

if d = nil then
MsgBox p.LasterrorMessage
else
d.PaperSize = d.DMPAPER_A5
d.Fields = BitwiseOr(d.Fields, d.DM_PAPERSIZE)
d.Orientation = d.DMORIENT_LANDSCAPE
d.Fields = BitwiseOr(d.Fields, d.DM_ORIENTATION)

if p.SetPrinterSettings(d, 9) then
MsgBox "OK"
else
MsgBox "Failed: "+p.LasterrorMessage
end if
end if
Notes:
Mode can be 2 (general printer information), 8 (global settings) or 9 (user settings).

For more information on the GetPrinter function, check this website:
http://msdn.microsoft.com/en-us/library/dd145082(v=vs.85).aspx

Feedback, Comments & Corrections

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




Links
MBS FileMaker tutorial videos