PA_OpenPrinterSession

4D - Documentation   Français   English   German   4D Plugin API, Command Theme List   4D Plugin API, Command Alphabetical List   Back   Previous   Next

version 2003


PA_OpenPrinterSession

ParameterTypeDescription
This command does not require any parameters

Description

The routine PA_OpenPrinterSession waits for the completion of the current printing operation (if any) performed by another process and then provides the 4D plug-in with exclusive access to the printer.

If the 4D plug-in directly performs printing operations it must have exclusive access to the printer.

If a print operation is being performed by an other process when the 4D plug-in calls PA_OpenPrinterSession, the routine waits until the printing operation has completed and the other process has released the PrintManager. During that time, 4th Dimension automatically displays a small floating window to inform the user that the print operation is waiting.

There is no way for the 4D plug-in to cancel this wait. To avoid this, better use PA_TryToOpenPrinterSession.

IMPORTANT NOTE:

A call to PA_OpenPrinterSession must be counter-balanced by a call to PA_ClosePrinterSession. If this is not done, the PrintManager will be unavailable to all the other processes for the duration of the active 4th Dimension session.

On Macintosh, this routine will call internally PrOpen, so you won't have to call it yourself.

Example

Sample code.

   void PrintSomething( char *toPrint, long len)
   {
      // open a printer session
      if ( PA_OpenPrinterSession() )
      {
         /* . . . Printing code . . . */

         PA_ClosePrinterSession();
      }
      else
         PA_Alert("No Printer available.");
   }

See Also

PA_ClosePrinterSession, PA_TryToOpenPrinterSession.

Error Handling

PA_GetLastError always returns eER_NoErr


4D - Documentation   Français   English   German   4D Plugin API, Command Theme List   4D Plugin API, Command Alphabetical List   Back   Previous   Next