DOCERR: Get/SetCommEventMask Functions Documented Incorrectly

Last reviewed: July 23, 1997
Article ID: Q81143
3.00 3.10 WINDOWS kbprg kbdocerr

The information in this article applies to:

  • Microsoft Windows Software Development Kit (SDK) for Windows versions 3.0 and 3.1

SUMMARY

The descriptions in the Microsoft Windows SDK "Reference Volume 1" of GetCommEventMask() and SetCommEventMask() fail to make clear the correct use of these routines and their usefulness. This article provides additional documentation for these important communications functions.

MORE INFORMATION

Some background information is in order. In a communications context, the "event word" is a word of memory the bits of which specify the events that have occurred. An "event mask" is a word-sized parameter to a function. The bits of the event mask specify the bits in the event word that are affected by a given function call.

WORD GetCommEventMask(nCid, nEvtMask)

The description for the GetCommEventMask() function, on page 4-162 of the SDK reference, reads as follows:

   This function retrieves the value of the current event mask, and
   then clears the mask.

A more appropriate description might read similar to the following:

   This function retrieves the value of the current event word, and
   then clears those bits in the event word that are specified by the
   nEvtMask parameter.

If this function was named GetCommEventWord, it might be easier to associate the name of the function with its purpose.

Note: The GetCommEventMask() API will return the entire current event word regardless of the value of nEvtMask.

WORD FAR * SetCommEventMask(nCid, nEvtMask)

The description for the SetCommEventMask() API, on page 4-373 of the SDK reference, reads as follows:

   This function enables and retrieves the event mask of the
   communications device specified by the nCid parameter. The bits of
   the nEvtMask parameter define which events are to be enabled. The
   return value points to the current state of the event mask.

A more appropriate description might read similar to the following:

   This function enables the event mask of the communications device
   specified by the nCid parameter. The bits of the nEvtMask parameter
   define which events are to be enabled. The return value points to
   the current state of the event word.

SetCommEventMask returns a far pointer to the event word. The result pointer points to "live" data; this word changes as events occur. An application can use the pointer to check the event word to quickly determine which events have occurred. However, to clear bits in the event word, the application must call GetCommEventMask(). Do not write through the pointer returned by SetCommEventMask(). SetCommEventMask() does not alter the current event word.


Additional reference words: 3.00 3.10
KBCategory: kbprg kbdocerr
KBSubcategory: KrCommapi
Keywords : kb16bitonly


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: July 23, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.