Opening The Dtr Driver; Closing The Dtr Driver; Writing To The Dtr Driver; Dtr Printer Communications - Intermec 700 Series 700 User Manual

Monochrome mobile computer
Hide thumbs Also See for 700 Series 700:
Table of Contents

Advertisement

Opening the DTR Driver

Closing the DTR Driver

Writing to the DTR Driver

DTR Printer Communications

700 Series Monochrome Mobile Computer User's Manual
The application opens the DTR driver by using the CreateFile() function.
The call can be implemented as follows:
hFile = CreateFile(_T("DTR1:"), GENERIC_WRITE, 0, NULL,
OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
The first parameter "DTR1:" must reflect the device name and index used
in the RegisterDevice() function call.
The function call will fail for any of the following reasons:
S The port associated with the device during RegisterDevice() is currently
in use.
S The DTR 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.
Using the CloseHandle() (hFile) function closes the DTR driver. Where
hFile is the handle returned by the CreateFile() function call.
S TRUE indicates the device is successfully closed.
S FALSE indicates an attempt to close a NULL HANDLE or an already
closed device.
You can use the WriteFile() function to send all Print data to the printer.
The print data being written must contain the proper formatting printer
commands.
All DTR printer communications should be based on the following flow:
1 Use CreateFile(); to open the printer driver.
2 Use WriteFile() to write your data to the printer. Check for errors and
that all data were written.
3 Use CloseHandle() to close the driver.
Chapter 5
Printer Support
143

Advertisement

Table of Contents
loading

Table of Contents