Title: VB Port Test – Visual Basic Sample Application
Date: May 17, 2001
Author: Chris Dore
About This KDB:
The Visual Basic (VB) sample application, VB Port Test, is an example of how to open more than 16 serial ports in VB.
The MSComm control that ships with VB will only allow a specified pot number to be in the range of 1 to 16.
This leads to problems for people who wish to use multi-port adapters in VB.
The solution to this problem is to use the Windows Application Programming Interface (API). This allows a programmer to access all of windows standard system calls. This is generally done with C programs however it is also possible to do so in VB.
Using the sample application:
- A copy of the project’s files VBPT100.zip
- Microsoft Visual Basic 6 (although 5 could be used, you will have to take extra steps to convert the project’s files).
- Knowledge of how to get around and use VB (the more you know the better).
- Knowledge of Windows API’s is a definite asset.
Running the sample:
- Unzip the project files into some directory.
- Open the VBPortTest.vbp project file in VB.
- Run it (it should work, if not please email firstname.lastname@example.org).
Compiling the sample to an executable:
- Select “Project” Menu → “VBPortTest Properties”
- From the “Compile” tab, make sure “Compile to P-Code” is selected. For some unknown reason none of the “Compile to Native Code” options work correctly. If you wish you can try these.
- Click “OK”.
- Select “File” Menu → “Make VBPortTest.exe…”
- Select a destination directory and filename and click “OK”. This should compile and create an executable program file.
End of KDB-279