Intermec 6200 Reference Guide

Page of 410
SECTION 3
Supporting Windows Applications
PEN*KEY
R
 6200/6300 Hand-Held Computer Programmer’s Reference Guide    3-39
Default Error-Handling Mode
Once the drivers are loaded as defined in the preceding paragraphs, no special
processing by the application is needed.  This makes it possible for offĆtheĆshelf
packages to take advantage of the IrDA protocol.  In this mode, all
printerĆrelated errors are handled by the IrDA driver.  A message is displayed
and the user has the ability to Cancel or Retry.  If the user selects Retry, the
driver attempts to continue printing.  If the user selects Cancel, the driver
attempts to clean up.  The standard Windows API returns a standard error,
indicating that a problem occurred.  This is the application's signal to abort the
print job.
Application-Defined Error-Handling Mode
In this mode, the application can link to the IrDA driver in the same manner
that it would link to any Windows DLL.  Once linked, the application can use the
driver's API to perform various operations.  The application registers a callback
with the driver. The application needs to perform the following actions to define
a new error handler:
1. Link to driver and obtain 
PrtService
 entry point.
2. Call 
PrtService
 to enable the driver, using 
PRT_ENABLE (0x0001)
.
3. Call 
PrtService
 to register the new handler, using 
PRT_SETPROC (0x0010)
and the address of the new handler.  The new handler should have the
following prototype:
extern “C” WORD _export FAR PASCAL ShowPrtError( WORD wCurErr )
This callback is called for each error and must return 
IDCANCEL (0x02),
IDRETRY (0x04)
 or 
0
.  If the application returns 
0
, the default handler proĆ
cesses the error.  For consistency, the application should handle all the erĆ
rors.  Use any method for displaying the message you want.  Make your
dialog model, if possible.  Remember that, depending on the method of disĆ
playing the message, you may need to translate the return values into 
ID-
CANCEL
 or 
IDRETRY
 so the printer driver knows how to deal with it.  See the
Error Codes and Messages topic, on page 3Ć41, for the various error condiĆ
tions that can occur.
4. Perform normal printing operations.
5. Call 
PrtService
 to remove the error handler, using 
PRT_SETPROC (0x0010)
and a 
NULL
 value for the handler address.
6. Call
 
PrtService
 to disable the driver, using
 
PRT_DISABLE (0x0002)
.
See the Printer Services API topic, below, for more information about available
printer services.
Printer Services API
The IrDA printer driver includes an API to provide access to the features of the
IrDA driver that are not available through the standard Windows API.
3. Windows
Applications