FIX: Posting WM_COMMNOTIFY Messages May Fail

Last reviewed: October 29, 1997
Article ID: Q108309
3.10 WINDOWS kbprg kbbuglist kbfixlist

The information in this article applies to:

  • Microsoft Windows Device Development Kit (DDK) for Windows version 3.1

SYMPTOMS

When using WM_COMMNOTIFY messages in a communications application, these messages may appear to have stopped being posted.

CAUSE

When COMM.DRV calls PostMessage(), it does not check the return value. Even if PostMessage() fails, it appears to COMM.DRV that the message was sent.

For CN_EVENT notifications, the event must be cleared using GetCommEventMask() before a new CN_EVENT notification will be sent. If the application never receives the CN_EVENT notification, the event never gets cleared, so COMM.DRV will not send a new CN_EVENT notification. If this happens, the notification process appears to have stopped.

Similarly, for CN_RECEIVE and CN_TRANSMIT notifications, if these notifications are not received, the application may not know to do a ReadComm() or WriteComm(). If ReadComm() or WriteComm() is never called, the character level will never cross the buffer threshold to create a new notification. For more information on how CN_RECEIVE and CN_TRANSMIT notifications are generated, query on the following words in the Microsoft Knowledge Base:

   docerr and CN_RECEIVE and events and generated

RESOLUTION

Implement a polling strategy to determine communications status, in addition to using WM_COMMNOTIFY messages. This could be implemented in the message loop of the application, or by using a timer.

STATUS

Microsoft has confirmed this to be a problem in Windows version 3.1. This bug has been corrected in later versions of Microsoft Windows.


Additional reference words: 3.10 buglist3.10
KBCategory: kbprg kbbuglist kbfixlist
KBSubcategory: CnaCEnablenot
Solution Type : kbfix


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: October 29, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.