Cool Visual Basic
 
Main
Frequently Asked Questions
VB Helpdesk
Message Boards
Library
Downloads
View Guestbook
Add to Guestbook
Product Reviews
Bookstore
Links
Newsgroups
Vendors
Affiliates
Cooltech.org

Cool VB FAQ


Text Format

The best Visual Basic FAQ(Frequently Asked Quesitions) file on the internet. Do you have a problem that's got you stumped? Do you have the answer to one? We've done our best to make this the best resources for the questions and the answers. Post a question, or a answer to one, by sending email to VBQA@beadsandbaubles.com.

      Root

            Port/Serial I/O

  • What commands (if any) are used to access the parallel port (both to output and to read)? Similar to the "out" command in some Basics?

    Compatibility:VB3  VB4  VB5

    You have a choice. You can use the MS-Comm ocx, which is available by clicking Project->Components->Microsoft Comm Control XX.0.

    The best way is to use our DLL, CVBIO. You can get it at our download site.

    It's free of charge. However, the following text: "Portions copyright 1997, Cool VB. http://www.beadsandbaubles.com/coolvb/" must be put in one or more of the following: the credits, the manual, or the about box.

    Here are the declarations:

    Private Declare Function cvbInp Lib "cvbio.dll" (ByVal Port As Integer) As Byte
    Private Declare Function cvbInpw Lib "cvbio.dll" (ByVal Port As Integer) As Integer
    Private Declare Function cvbInpd Lib "cvbio.dll" (ByVal Port As Integer) As Long
    
    Private Declare Function cvbOut Lib "cvbio.dll" (ByVal Port As Integer, ByVal Value As Byte) As Boolean
    Private Declare Function cvbOutw Lib "cvbio.dlll" (ByVal Port As Integer, ByVal Value As Integer) As Boolean
    Private Declare Function cvbOutd Lib "cvbio.dlll" (ByVal Port As Integer, ByVal Value As Long) As Boolean
    

    The other option is to access the port directly, like this:

      'Input   
      dim s as string    
       open "LPT1" for input as #1
       s = input(numberofbytestoread, 1)   
       close #1   
    
       'Output
       open "LPT1" for output as #1     
       print #1, "thestufftosend"   
    close #1

     

     

    LinkExchange
    LinkExchange Member Free Home Pages at GeoCities


    Copyright 2000, David J Berube<Form1@aol.com>. All Rights Reserved.