SECTION 3
Supporting Windows Applications
PEN*KEY
R
6200/6300 Hand-Held Computer Programmer’s Reference Guide 3-33
Calling PrtService
NORNPCP.DRV contains an exported procedure PrtService( HINSTANCE hInst,
WORD wOpt, LPARAM lParam1, LPARAM lParam2) that provides the API for
the driver. The parameters to the procedure are as follows:
HINSTANCE hInst
instance handle to our application.
WORD wOpt
option for action you want to perform.
LPARAM 1Param1
doubleword that depends on the particular option.
LPARAM 1Param2
doubleword that depends on the particular option.
The value returned by PrtService depends on the option selected. See specific
options for more details. The entry point can be called just like any Windows
procedure, as shown in the following fragment:
if ( lpfnPrtService( hInst, PRT_ENABLE, (LPARAM)NULL,
(LPARAM)NULL ) < 1) {
MessageBox( NULL, “Unable to enable printer driver”,
“ERROR”, MB_OK | MB_ICONEXCLAMATION );
return FALSE;
}
Supported PrtService Options
PrtService provides the following services:
"
Enable Driver.
Enables the driver and installs the default error handler.
Set the following:
"
wOpt
to
PRT_ENABLE (0x0001)
"
1Param1
to 0
"
lParam2
to 0
"
Disable Driver.
Disables the driver. Set the following:
"
wOpt
to
PRT_DISABLE (0x0002)
"
lParam1
to 0
"
lParam2
to 0
"
Query Driver for support of an option.
Determines whether the driver
supports a particular feature. Set the following:
"
wOpt
to
PRT_GETSUPPORT (0x0003)
"
lParam1
to the value of the option you want checked.
"
lParam2
to 0
"
Install/Remove External Error handler.
Installs or removes our
applications error handler. Set the following:
"
wOpt
to
PRT_SETPROC (0x0010)
"
lParam1
to a far pointer to our error handling procedure. A 0 value
removes the handler. Call
MakeProcInstance(...)
to obtain the
value.
"
lParam2
to 0
"
Flush Driver.
Flushes all the data buffers so that everything sent to the
printer actually prints. Set the following:
"
wOpt
to
PRT_FLUSH (0x0020)
"
lParam1
to 0
"
lParam2
to 0
3. Windows
Applications