National Instruments PC-OPDIO-16 Manuale Utente

Pagina di 92
The Fundamentals of Building Applications with NI-DAQChapter 4
PC-OPDIO-16 User Manual
4-4
© National Instruments Corporation
Running Your Application Inside the Visual Basic Environment
First, you must create an NI-DAQ Quick library.
MAKEQLB.BAT
 in the 
QLBUTIL
 subdirectory is useful for creating Quick libraries for Visual
Basic.
The steps for making a Quick library are as follows:
1. Edit 
NIDAQ.BAS
.  Remove the keyword 
REM
 from functions you want to include in the
Quick library.
2. Run this batch file by using the following command:
MAKEQLB VB
3. If all files needed to build the Quick library are found, and the linking was successful, the
batch file creates a Quick library in the 
NI-DAQ LIB
 subdirectory with a 
.QLB
 extension.
Next, load the Quick library when you enter the environment by using the following
command:
vbdos /l NIDAQVB
Note: Visual Basic returns an out-of-memory error either when you try to load the Quick
library or when you try to run your application.  You may try to free up memory by
removing as many TSRs or device drivers as possible before entering the Visual Basic
environment.
After you are inside the environment, you can load the source file of your application and run it.
Compiling and Running Your Visual Basic Application from the DOS Prompt
The steps to run your application outside Visual Basic environment are as follows:
1. Compile your source code with the Visual Basic compiler. For example:
bc /O diginout.bas;
Note: NOT ENOUGH MEMORY—If the Visual Basic compiler does not have enough
memory to compile your application, you should first try to make available as much
conventional memory as possible.  See your DOS manual for information on how
to do so.  If you still cannot compile your application, you can edit the files
NIDAQ.INC
 (or 
NIDAQR.INC
) and 
NIDAQCNS.INC
 to reduce their size.
2. Link the object file (using Microsoft Overlay Linker Version 3.61 or later) produced in step 1
with 
NIDAQMSC.LIB
SUP71.LIB
, and the Visual Basic library. For example:
link /NOE /NOD /SEG:250 diginout,,, VBDCL10E NIDAQMSC SUP71;
You must include the 
SUP71
 library in your link command because the DOS NI-DAQ
library 
NIDAQMSC.LIB
 is compiled using the Microsoft C compiler.  Microsoft C support
functions are contained in the 
SUP71
 library, which you can find in the 
NI-DAQ LIB
subdirectory.  You should include the NI-DAQ 
LIB
 directory and the Basic 
LIB
 directory in