Specifications

190 Chapter 16
ESA/PSA Programming Examples
Using Visual Basic® 6 to Capture a Screen Image
ESA/PSA Programming Examples
Dim headerlength As Long length of header
Set the default number of bytes that will be contained in the
ResultsArray to 50,000 (50kB)
length = 50000
Set the array of pointers to the addresses of the variables
ArrayPtr(0) = VarPtr(length)
ArrayPtr(1) = VarPtr(ResultsArray(0))
Delete picture.gif file if it exists
On Error Resume Next
Kill "picture.gif"
On Error GoTo Error_Handler
Open the default resource manager session
status = viOpenDefaultRM(defrm)
Open the session. Note: For PSA, to use LAN, change the string to
"TCPIP0::xxx.xxx.xxx.xxx::inst0::INSTR" where xxxxx is the IP address
status = viOpen(defrm, "GPIB0::18::INSTR", 0, 0, vi)
If (status < 0) Then GoTo VisaErrorHandler
Set the I/O timeout to fifteen seconds
status = viSetAttribute(vi, VI_ATTR_TMO_VALUE, 15000)
If (status < 0) Then GoTo VisaErrorHandler
Store the current screen image on flash as C:PICTURE.GIF
status = viVPrintf(vi, ":MMEM:STOR:SCR C:PICTURE.GIF" + Chr$(10), 0)
If (status < 0) Then GoTo VisaErrorHandler
Grab the screen image file from the instrument
status = viVQueryf(vi, ":MMEM:DATA? C:PICTURE.GIF" + Chr$(10), _
"%#y", ArrayPtr(0))