Choose a country or area to see content specific to your location
Enable browser cookies for improved site capabilities and performance.
Toggle Menu
-
PRODUCTS AND SERVICES
- Oscilloscopes
-
Analyzers
- Spectrum Analyzers (Signal Analyzers)
- Network Analyzers
- Logic Analyzers
- Protocol Analyzers and Exercisers
- Bit Error Ratio Testers
- Noise Figure Analyzers and Noise Sources
- High-Speed Digitizers and Multichannel DAQ Solutions
- AC Power Analyzers
- DC Power Analyzers
- Materials Test Equipment
- Device Current Waveform Analyzers
- Parameter / Device Analyzers and Curve Tracers
- Meters
- Generators, Sources, and Power Supplies
- Software
- Wireless
- Modular Instruments
- Network Test and Security
- Network Visibility
- Services
- Additional Products
- All Products, Software, Services
- Learn
- Buy
- Support
- Home
- Resources
- Resources
What are you looking for?
Suggested searches
No product matches found - System Exception
Matched content
BMP Windows bitmap
Screen Images as Bitmaps (BMP)
Some of the more recent instruments let you retrieve the screen image as a bitmap. This makes getting the image into a PictureBox reasonably simple. The Keysight 54620-series oscilloscopes let you retrieve a bitmap from the I/O with just a few lines of code. The bitmap is in the IEEE 488.2 binary block data format. Getting the data into a binary file looks like this.
Dim byteData() As Byte
Const filePath = "C:\~scp_tmp.bmp"
With Scope .IO.Timeout = 15000 .WriteString ":DISPlay:DATA? BMP, SCReen" byteData = .ReadIEEEBlock(BinaryType_UI1) .IO.Timeout = 10000 End With
You have to declare the 'byteData' as a dynamic array because the size of the data is unknown. The code will return an IEEE488.2 block as bytes. Next save the byte array to a file and then call it with LoadPicture() That's all there is to it. The complete code looks like this:
Private Sub cmdGetBitMap_Click() ' Gets the bitmap from a 5462xA scope Dim byteData() As Byte Dim dummy As String Const filePath = "C:\~scp_tmp.bmp" Set Picture1 = LoadPicture("") With Scope .IO.Timeout = 15000 .WriteString ":DISPlay:DATA? BMP, SCReen" byteData = .ReadIEEEBlock(BinaryType_UI1) .IO.Timeout = 10000 End With saveAsFile filePath, byteData Picture1.AutoSize = True Set Picture1 = LoadPicture(filePath) Kill filePath End Sub
Private Sub saveAsFile(ByVal filePath As String, _ byteData() As Byte) Dim hFile As Long Dim isOpen As Boolean hFile = FreeFile() Open filePath For Binary Access Write Shared As hFile isOpen = True Put #hFile, , byteData If isOpen Then Close #hFile End Sub
Related Links
- © Keysight Technologies 2000–2024
- Privacy
- Sitemap
- Terms
- Trademark Acknowledgements
- Feedback
- Accessibility