Microsoft KB Archive/75856

= FILE: VB3 Program Example for COM Port Support in Visual Basic =

Article ID: 75856

Article Last Modified on 8/4/2004

-

APPLIES TO


 * Microsoft Visual Basic 1.0 Standard Edition
 * Microsoft Visual Basic 2.0 Standard Edition
 * Microsoft Visual Basic 3.0 Professional Edition

-



This article was previously published under Q75856



SUMMARY
A sample program (VBCOMDEM) is available to show you how a Visual Basic program can use Windows API functions for serial port communications. This program may not be necessary in Visual Basic versions 2.0 and 3.0 for Windows because COM support is already built into the Communications Control, which comes with the Professional Edition.



MORE INFORMATION
The following file is available for download from the Microsoft Download Center:

Vbcomdem.exe

For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base:

119591 How to Obtain Microsoft Support Files from Online Services

Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help to prevent any unauthorized changes to the file. When you run VBCOMDEM.EXE, you will have the following four files:

SIMPCOMM.EXE, SIMPCOMM.FRM, SIMPCOMM.GLB, SIMPCOMM.MAK

In the Visual Basic environment (VB.EXE), you can load the files in this sample program by choosing Open Project from the File menu and selecting the SIMPCOMM.MAK file.

You can also run SIMPCOMM.EXE in Windows as a separate program that requires the Visual Basic run-time file VBRUN100.DLL.

This sample program is only a starting point. It does not use all of the serial communications API functions available through Windows. This simple example uses Windows API Comm functions, such as OpenComm, CloseComm, ReadComm, and WriteComm. You are free to modify and extend the program to suit your specific needs.

The SIMPCOMM program has no error trapping, and makes no allowances for noisy communication lines or handshaking errors. Should an error occur, Windows will suspend all reading from the communications port until you clear the error by calling the Windows API function GetCommError.

To modify or understand this program example, you must have a reference manual for the Windows API routines.

