Specifications

Chapter 16 189
ESA/PSA Programming Examples
Using Visual Basic® 6 to Capture a Screen Image
ESA/PSA Programming Examples
’’ declarations needed to make VISA calls from Visual Basic.
’’ To add this module to your project in VB 6, from the menu, select
’’ Project->Add Module, select the Existing tab, and browse to the
’’ directory containing the VB Declaration file, select visa32.bas, and
’’ press Open.
’’
’’ The name and location of the VB declaration file depends on which
’’ operating system you are using. Assuming the standard VISA directory
’’ of C:\Program Files\VISA or the standard VXIpnp directory of
’’ C:\VXIpnp, the visa32.bas file can be located in one of the following:
’’
’’ \winnt\agvisa\include\visa32.bas - Windows NT/2000/XP
’’ \winnt\include\visa32.bas - Windows NT/2000/XP
’’ \win95\include\visa32.bas - Windows 95/98/Me
’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’
screen.bas
The following example program is written for the PSA and ESA Series
Spectrum Analyzers. It stores the current screen image on the
instruments flash as C:PICTURE.GIF. It then transfers the image over
GPIB or LAN and stores the image on your PC in the current directory
as picture.gif. The file C:PICTURE.GIF is then deleted on the
instruments flash.
’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’
Option Explicit
Private Sub Main()
Declare Variables used in the program
Dim status As Long VISA function status return code
Dim defrm As Long Session to Default Resource Manager
Dim vi As Long Session to instrument
Dim x As Integer Loop Variable
Dim ArrayPtr(1) As Long Array of Pointers
Dim ResultsArray(50000) As Byte results array, Big enough to hold a GIF
Dim length As Long Number of bytes returned from instrument
Dim fnum As Integer File Number to used to open file to store data
Dim isOpen As Boolean Boolean flag used to keep track of open file