Example Code

Archived: Language Interface: 16-bit Microsoft Visual Basic for DOS

Code and Documents

Attachment

Overview


This document has been archived and is no longer updated by National Instruments.

This is the GPIB language interface for Microsoft Visual Basic for DOS (version 1.0), a DOS programming environment for creating 16-bit applications. Download the "Basic7.zip" file (in the example.zip file, below). This file contains the declaration file MBDECL.BAS, the language interface file MBIB.OBJ, and some sample programs.


How to Use the Microsoft Visual Basic for DOS Language Interface:
I. Overview

The 16-bit GPIB language interface for Microsoft Visual Basic for DOS contains the following files:
MBDECL.BAS: Microsoft BASIC program declarations
MBIB.OBJ: Microsoft BASIC language interface object module
If you have the GPIB Software for DOS, the Microsoft Visual Basic for DOS language interface and the sample applications are located in the directory called \BASIC7 (where is where the GPIB software for DOS is installed).
II. Items to Include in Your GPIB Application
You must include the following line at the beginning of your application:
'$INCLUDE: 'MBDECL.BAS'

[ Note: Do not list mbdecl.bas in a project .MAK file. ]
Next you need to link the MBIB.OBJ file to your application.
III.A. Compiling, Linking, and Running from the Visual Basic for DOS Environment
Before you can run an application, called "yourprog", from within the Visual Basic interactive environment, follow the steps listed below:
1. From the DOS command line, create an object module library called VBIB.LIB, by typing in the following:
LIB VBIB.LIB + MBIB.OBJ + VBDOS.LIB;
2. From the DOS command line, to create a QuickLibrary called VBIB.QLB that is linked with the MBIB.OBJ language interface, type in:
LINK /Q MBIB.OBJ VBDOS.LIB, VBIB.QLB,, VBDOSQLB.LIB;

[ NOTE: Please remember to include the two commas between VBIB.QLB and VBDOSQLB.LIB. ]
3. To invoke the Visual Basic environment where you can run the application called "yourprog", type the following on the DOS command line:
VBDOS YOURPROG /L VBIB.QLB
III.B. Compiling, Linking, and Running from the DOS Command Line
To run an application, called "yourprog", from the DOS command line, follow the steps listed below:
1. To compile the BASIC program, called "yourprog", type in:
BC YOURPROG;
2. To link the BASIC application, called "yourprog", with the MBIB.OBJ language interface, enter the following:
"LINK YOURPROG MBIB;"
3. To run the application, called "yourprog", from the command line, type in:
"YOURPROG"

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Contributors