EnableCommNotification

3.1

  BOOL EnableCommNotification(idComDev, hwnd, cbWriteNotify, cbOutQueue)    
  int idComDev; /* communications-device identifier */
  HWND hwnd; /* handle of window receiving messages */
  int cbWriteNotify; /* number of bytes written before notification */
  int cbOutQueue; /* minimum number of bytes in output queue */

The EnableCommNotification function enables or disables WM_COMMNOTIFY message posting to the given window.

Parameters

idComDev

Specifies the communications device that is posting notification messages to the window identified by the hwnd parameter. The OpenComm function returns the value for the idComDev parameter.

hwnd

Identifies the window whose WM_COMMNOTIFY message posting will be enabled or disabled. If this parameter is NULL, EnableCommNotification disables message posting to the current window.

cbWriteNotify

Indicates the number of bytes the COM driver must write to the application's input queue before sending a notification message. The message signals the application to read information from the input queue.

cbOutQueue

Indicates the minimum number of bytes in the output queue. When the number of bytes in the output queue falls below this number, the COM driver sends the application a notification message, signaling it to write information to the output queue.

Return Value

The return value is nonzero if the function is successful. Otherwise, it is zero, indicating an invalid COM port identifier, a port that is not open, or a function not supported by COMM.DRV.

Comments

If an application specifies –1 for the cbWriteNotify parameter, the WM_COMMNOTIFY message is sent to the specified window for CN_EVENT and CN_TRANSMIT notifications but not for CN_RECEIVE notifications. If –1 is specified for the cbOutQueue parameter, CN_EVENT and CN_RECEIVE notifications are sent but CN_TRANSMIT notifications are not.

If a timeout occurs before as many bytes as specified by the cbWriteNotify parameter are written to the input queue, a WM_COMMNOTIFY message is sent with the CN_RECEIVE flag set. When this occurs, another message will not be sent until the number of bytes in the input queue falls below the number specified in the cbWriteNotify parameter. Similarly, a WM_COMMNOTIFY message in which the CN_RECEIVE flag is set is sent only when the output queue is larger than the number of bytes specified in the cbOutQueue parameter.

The Windows 3.0 version of COMM.DRV does not support this function.