OpenComm

Syntax

int OpenComm(lpComName,wInQueue,wOutQueue)

This function opens a communication device and assigns an nCid handle to it. The communication device is initialized to a default configuration. The SetCommState function should be used to initialize the device to alternate values. The OpenComm function allocates space for receive and transmit queues. The queues are used by the interrupt-driven transmit/receive software.

Parameter Type/Description  

lpComName LPSTR Points to a string which contains COMn or LPTn, where n ranges from 1 to the number of communication devices available for the particular type of I/O port.  
wInQueue WORD Specifies the size of the receive queue.  
wOutQueue WORD Specifies the size of the transmit queue.  

Return Value

The return value specifies the open communication device. If an error occurs, the return value is one of the following negative error values:

Value Meaning  

IE_BADID Invalid or unsupported ID.  
IE_BAUDRATE Unsupported baud rate.  
IE_BYTESIZE Invalid byte size.  
IE_DEFAULT Error in default parameters.  
IE_HARDWARE Hardware not present.  
IE_MEMORY Unable to allocate queues.  
IE_NOPEN Device not open.  
IE_OPEN Device already open.  

Comments

LPT ports are not interrupt driven. For these ports, the nInQueue and nOutQueue
parameters are ignored, and the queue size is set to zero.