AnsweredAssumed Answered

Oscilloscope Screen Dump (:DISPLAY:DATA?) - embeds intrusive error message

Question asked by vnissimo on Jul 10, 2014
Latest reply on Sep 28, 2015 by nl5
When capture screen (myScope.WriteString ":DISPLAY:DATA? BMP, SCR, COL"), 
screen captured BMP picture contains "Invalid Character" or "Remote operation completed" right in the middle.
If sub is run on its own, the problem does not exist. If sub in embedded in longer code, "Invalid character" appears.
If sub is called immediately second (or more) times, "Remote operation completed" appears.
How to fix? Tks.
Scope: DSO6034A
Windows Vista, Excel 2007 VBA, tried NI and also Agilent library as primary with same problem.
Agilent lib. version 16 (newest - installed yesterday). Code slightly modified from scope programmer manual.

Sub DumpImage(io_ As String, strPth As String)
Dim ioMgr As VisaComLib.ResourceManager
Dim myScope As VisaComLib.FormattedIO488
Dim fn As Integer, tmr As Double
Set ioMgr = New VisaComLib.ResourceManager
Set myScope = New VisaComLib.FormattedIO488
Set myScope.IO = ioMgr.Open(io_)
' IMAGE_TRANSFER - In this example, we will query for the image data
' with ":DISPLAY:DATA?", read the data, and then save it to a file.
Dim byteData() As Byte
' Remove file if it exists.
If Len(Dir(strPth)) Then
Kill strPth
End If
myScope.WriteString ":DISPLAY:DATA? BMP, SCR, COL"     ' & Chr(10)
byteData = myScope.ReadIEEEBlock(BinaryType_UI1)
fn = FreeFile()
Open strPth For Binary Access Write Lock Write As #fn ' Open file for output.
Put #fn, , byteData ' Write data.
Close #fn   ' Close file.

End Sub