DirectIO¶
Description
Sends and receives binary data.
Syntax
INT DirectIO( INT i_hdl, BYTE i_wlen, LPBYTE i_wcmd, LPBYTE io_rlen, LPBYTE o_rbuf, DWORD i_timeout, BOOL i_flag )
Parameter
i_hdl
API handle
Specify the API handle retrieved by OpenMonPrinter.
i_wlen
Size of data to send
Specify the size of data to send.
i_wcmd
Buffer of data to send
Specify the buffer in which the data to send is stored.
io_rlen
Size of data to receive
Specify the maximum length of data to be received from the printer.
Specify 0 when data retrieving is not necessary.
When the control returns from the API, the retrieved receive data size is stored.
o_rbuf
Buffer of data to receive
Specify the buffer that stores the data to get.
i_timeout
Timeout period
Specify the time to wait for success of this API in milliseconds (ms).
The valid range is from 3000 to 90000.
When the value is specified less than 3000, the time is set to 3000 ms.
When the value is specified more than 90000, the time is set to 90000 ms.
i_flag
Receive operation flag
Specify the flag to specify the receive operation from the following:
TRUE: Continues receiving until any data is received or timeout occurs.
FALSE: Continues receiving until the receive data size is received or timeout occurs.
Return value
On success: Returns 0. On failure: Returns an error code. See "Error Code List" for details of the error code.
Remarks
- In the case of sending commands, data, and image data that do not allow interrupt of other data, call this API after calling LockPrinter. When LockPrinter is not called, data from other processes may interrupt.
- Receive data does not include the response of the ASB setting command. To get data that includes the response of the ASB setting command, call DirectIOEx.
- This API can be aborted by Reset.
- When LockPrinter is being called by another process, calling this API fails.
- When the printer is not connected or in a communication disabled state, this API fails.