Screen Capture

Other topics about Sample Programs

Overview

The sample program demonstrates to capture the E5063A screen and save it as .png file into the external PC.

Sample Program in Excel VBA

Sub ScreenCapture()

  '*** The variables of the resource manager and the instrument I/O are declared.

  Dim ImgData() As Byte

  Dim FileName As String

  Dim ioMgr As VisaComLib.ResourceManager

  Dim Ena As VisaComLib.FormattedIO488

 

  '*** The memory area of the resource manager and the instrument I/O are acquired.

  Set ioMgr = New VisaComLib.ResourceManager

  Set Ena = New VisaComLib.FormattedIO488

  

  '*** Open the instrument.

  Set Ena.IO = ioMgr.Open("GPIB0::17::INSTR")

  Ena.IO.timeout = 10000

  FileName = Range("B7").Value

  Ena.WriteString ":HCOP:SDUM:DATA:FORM PNG", True

  Ena.WriteString ":HCOP:SDUM:DATA?", True

  ImgData = Ena.ReadIEEEBlock(BinaryType_UI1, False, True)

  Open FileName For Binary As #1

     Put #1, , ImgData()

  Close

 '*** end procedure

  Ena.IO.Close

End Sub