User`s guide
24 Agilent VISA User’s Guide
2 Building a VISA Application in Windows
Sample Program Contents
A summary of the VISA function calls used in the preceding
sample Visual Basic program follows. For a more detailed
explanation of VISA functionality, see Chapter 3,
“Programming with VISA.” See the VISA Online Help for
more detailed information on these VISA function calls.
Call viOpen(defrm, "GPIB0::22::INSTR", 0, 0,
vi)
' Initialize device
Call viVPrintf(vi, "*RST" + Chr$(10), 0)
' Ask for the device's *IDN string.
Call viVPrintf(vi, "*IDN?" + Chr$(10), 0)
' Read the results as a string.
Call viVScanf(vi, "%t", strRes)
' Display the results
MsgBox "Result is: " + strRes, vbOKOnly,
"*IDN? Result"
' Close the vi session and the resource
manager session
Call viClose(vi)
Call viClose(defrm)
End Sub
Table 3 Summary of VISA Function Calls in Visual Basic Sample
Function(s) Description
viOpenDefaultRM You must first open a session with the default resource
manager with the viOpenDefaultRM function. This
function will initialize the default resource manager and
return a pointer (defrm) to that resource manager
session.