SetCommMask

  BOOL SetCommMask(hCommDev, dwEvtMask)    
  HANDLE hCommDev; /* identifies the comm device */
  DWORD dwEvtMask; /* event mask */

The SetCommMask function sets the event mask for the specified communications device.

Parameters

hCommDev

Identifies the communications device whose event mask is to be set. The CreateFile function returns this value.

dwEvtMask

An event mask which specifies which events are to be enabled. An enabled event can satisfy a wait. The mask is some combination of the following values:

Value Meaning

EV_BREAK  
  Sets when a break is detected on input.
EV_CTS  
  Sets when the clear-to-send (CTS) signal changes state.
EV_DSR  
  Sets when the data-set-ready (DSR) signal changes state.
EV_ERR  
  Sets when a line-status error occurs. Line-status errors are CE_FRAME, CE_OVERRUN, and CE_RXPARITY.
EV_RING  
  Sets when a ring indicator is detected.
EV_RLSD  
  Sets when the receive-line-signal-detect (RLSD) signal changes state.
EV_RXCHAR  
  Sets when any character is received and placed in the receive queue.
EV_RXFLAG  
  Sets when the event character is received and placed in the receive queue. The event character is specified in the device's control block.
EV_TXEMPTY  
  Sets when the last character in the transmit queue is sent.

Return Value

The return value is TRUE if the function was successful, or FALSE if an error occurred. Use the GetLastError function to obtain extended error information.

Comments

There is only one event mask per handle. Each subsequent call to SetCommMask replaces the previously set mask. A value of zero clears the mask and returns any outstanding WaitCommEvent functions.

The bits of the dwEvtMask parameter define which events are enabled. Only enabled events satisfy the WaitCommEvent function.

See Also

ClearCommBreak, ClearCommError, GetCommMask, GetCommState, GetCommTimeouts, PurgeComm, SetCommBreak, SetCommState, SetCommTimeouts, WaitCommEvent