VB3 Program Example for COM Port Support in Visual Basic

Last reviewed: September 17, 1997
Article ID: Q75856
1.00 2.00 3.00 WINDOWS kbprg kbfile

The information in this article applies to:

- Microsoft Visual Basic programming system for Windows,

  versions 1.0, 2.0, and 3.0

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.

You can find VBCOMDEM.EXE (size: 28549 bytes) 
                         , a self-extracting file, on these services:

  • Microsoft's World Wide Web site on the Internet

          On the www.microsoft.com home page, click the Support icon
          Click Knowledge Base, and select the product
    
          Enter kbfile VBCOMDEM.EXE (size: 28549 bytes) 
                                   , and click GO!
          Open the article, and click the button to download the file
    
    
  • Internet (anonymous FTP)

          ftp ftp.microsoft.com
          Change to the Softlib/Mslfiles folder
          Get VBCOMDEM.EXE (size: 28549 bytes) 
    
  • The Microsoft Network

          On the Edit menu, click Go To, and then click Other Location
          Type "mssupport" (without the quotation marks)
          Double-click the MS Software Library icon
          Find the appropriate product area
          Locate and Download VBCOMDEM.EXE
    
  • Microsoft Download Service (MSDL)

          Dial (206) 936-6735 to connect to MSDL
          Download VBCOMDEM.EXE (size: 28549 bytes) 
    

    For additional information about downloading, please see the following article in the Microsoft Knowledge Base:

       ARTICLE-ID: Q119591
       TITLE     : How to Obtain Microsoft Support Files from Online Services
    
    
    When you run VBCOMDEM.EXE, you will have the following four files:

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

    MORE INFORMATION

    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.

    REFERENCES

    "Microsoft Windows Programmer's Reference," Microsoft Press, 1990 Microsoft Windows 3.0 Software Development Kit


  • Additional reference words: 1.00 2.00 3.00 COM1 COM2 asynchronous softlib
    KBCategory: kbprg kbfile
    KBSubcategory: PrgCtrlsStd
    Keywords : PrgCtrlsStd kbfile kbprg
    Version : 1.00 2.00 3.00
    Platform : WINDOWS


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