The information in this article applies to:
SUMMARY
A problem with the communications driver causes a device contention
message box to appear when a nonexistent port is opened in enhanced
mode Windows using the OpenComm function. This article describes a
method of avoiding this message box when using the communication API
under enhanced mode Windows.
MORE INFORMATIONThe following files are available for download from the Microsoft
Download Center. Click the file names below to download the files: http://www.microsoft.com/downloads/search.aspand then click How to use the Microsoft Download Center. Under standard or real mode, the OpenComm function can be used to successfully test for the presence of communications hardware by checking the return value. If the return value of the OpenComm function is IE_HARDWARE, it is safe to assume that the hardware is not present. However, under enhanced mode Windows, calling the OpenComm function with a port ID that is not valid will cause the following message to appear on the screen: This message is also be displayed if the port ID is valid; however, it is in use by another virtual machine. To avoid this message in enhanced mode Windows, a communications application can call the API entry point of the virtual communications device (VCD) with a special function ID to determine the valid ports in the system. The code fragment included below will fill a byte with a value that enumerates the valid COM ports:
After running this code fragment, the value in bPortArray will
determine the valid ports. For example:
A value of 3 indicates that both COM1 and COM2 are present in the
system.
Additional query words:
Keywords : kbcode kbfile kbsample kb16bitonly kbKernBase kbComPort |
Last Reviewed: December 3, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |