Intermec 700 Laptop User Manual


 
Printer SupportChapter 5
200 700 Series Color Mobile Computer User’sManual
Opening the NPCP Driver
TheapplicationopenstheNPCPdriverbyusingtheCreateFile()
function. The call can be implemented as follows. The first parameter
LPT9:”mustreflectthedevicenameandindexusedinthe
RegisterDevice() function call and will fail for any of the following reasons:
hFile = CreateFile(_T(”LPT9:”), GENERIC_WRITE |
GENERIC_READ, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL,
NULL);
S The port associated with the device during RegisterDevice() is in use.
S The NPCP device is already open.
S The share mode is not set to zero. The device cannot be shared.
S Access permissions are not set to GENERIC_WRITE |
GENERIC_READ. Both modes must be specified.
Closing the NPCP Driver
Using the CloseHandle() (hFile) function closes the NPCP driver. Where
hFile is the handle returned by the CreateFile() function call.
S TRUE = the device is successfully closed.
S FALSE = an attempt to close NULL HANDLE or an already closed de-
vice.
Reading from the NPCP Driver
Reading of the NPCP printers is not supported since all responses from
the printer are the result of commands sent to the printer.
DeviceIoControl() functions are provided where data is to be received
from the printer.
Writing to the NPCP Driver
All Print data can be sent to the printer using the WriteFile() function.
The print data written to the driver must contain the proper printer
commands for formatting. If the function returns FALSE, the NPCP error
may be retrieved using IOCTL_NPCP_ERROR. See the description on
the next page.