Capturing Screen Into PC

Other topics about Saving/Recalling a Measurement Result

Overview

The program listed in the below section is written in VISA-COM with Excel VBA. It can be executed from the external PC controller. The program demonstrates how to capture screen into PC.

Capturing Screen Into 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 FilAnalyzerme As String

  Dim ioMgr As VisaComLib.ResourceManager

  Dim Analyzer As VisaComLib.FormattedIO488

 

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

  Set ioMgr = New VisaComLib.ResourceManager

  Set Analyzer = New VisaComLib.FormattedIO488

  

  '*** Open the instrument.

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

  Analyzer.IO.timeout = 10000

  FilAnalyzerme = Range("B7").Value

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

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

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

  Open FilAnalyzerme For Binary As #1

     Put #1, , ImgData()

  Close

 

 '*** End of procedure

  Analyzer.IO.Close

End Sub