Opens a print job and assigns it a number, which you use in other printing statements.
PrintOpen ( { jobname } )
Argument |
Description |
---|---|
jobname (optional) |
A string specifying a name for the print job. The name is displayed in the Windows Print Manager dialog box and in the Spooler dialog box. |
Long. Returns the job number if it succeeds and -1 if an error occurs. If any argument’s value is null, PrintOpen returns null.
A new print job begins on a new page and the font is set to the default font for the printer. The print cursor is at the upper left corner of the print area.
Use the job number that PrintOpen returns to identify this print job in all subsequent print functions.
Required third-party software You must install the FieldSoftware PrinterCE SDK before you can use print methods in PocketBuilder applications deployed to a device or emulator. An evaluation version of this software is available from the FieldSoftware Web site.
Calling MessageBox after PrintOpen can cause undesirable behavior that is confusing to a user. Calling PrintOpen causes the currently active window in PocketBuilder to be disabled to allow Windows to handle printing. If you display a MessageBox after calling PrintOpen, Windows assigns the active window to be its parent, which is often another application, causing that application to become active.
Balancing PrintOpen and PrintClose When you open a print job, you must close (or cancel) it. To avoid hung print jobs, process and close a print job in the same event in which you open it.
This example opens a job but does not give it a name:
ulong li_job
li_job = PrintOpen()
This example opens a job and gives it a name:
ulong li_job
li_job = PrintOpen("Phone List")