
Building a VISA Application in Windows
2
Agilent VISA User’s Guide
19
VISA cannot call back to a VB function. Thus, you can only use the
VI_QUEUE
mechanism in
viEnableEvent
. There is no way to
install a VISA event handler in VB.
VISA functions that take a variable number of parameters (
viPrintf
,
viScanf
,
viQueryf
) are not callable from VB. Use the
corresponding
viVPrintf
,
viVScanf
and
viVQueryf
functions
instead.
You cannot pass variables of type
Variant
to VISA functions. If you
attempt this, the Visual Basic program will probably crash with a
'General Protection Fault' or an 'Access Violation.'
Format Conversion Commands
The functions
viVPrintf
,
viVscanf
and
viVqueryf
can be
called from VB, but there are restrictions on the format conversions that
can be used. Only one format conversion command can be specified in a
format string (a format conversion command begins with the %
character).
For example, the following is invalid:
status = viVPrintf(vi, "%lf%d" + Chr$(10),
...)
Instead, you must make one call for each format conversion command,
as shown in the following example:
status = viVPrintf(vi, "%lf" + Chr$(10),
dbl_value)
status = viVPrintf(vi, "%d" + Chr$(10),
int_value)
Numeric Arrays
When reading from or writing to a numeric array, you must specify the
first element of a numeric array as the
params
parameter. This passes
the address of the first array element to the function. For example, the
following code declares an array of 50 floating point numbers and then
calls
viVPrintf
to write from the array.
Dim flt_array(50) As Double
status = viVPrintf(id, "%,50f", dbl_array(0))
Summary of Contents for E2094S
Page 6: ...6 Agilent VISA User s Guide ...
Page 116: ...116 Agilent VISA User s Guide 4 Programming via GPIB and VXI ...
Page 126: ...126 Agilent VISA User s Guide 5 Programming via LAN ...
Page 143: ...Glossary Agilent VISA User s Guide 143 Windows notification area See notification area ...