Screenshots with the CAPTUREIMAGE method
Published 21 JUN 2021 at 02:35:31PM
Bitmap controls in OpenInsight 10 have a method called CAPTUREIMAGE, which allows you to "screenshot" the contents of another OI control or form into the Bitmap control's IMAGE sub-object. As you can see, it has a very simple interface:
SuccessFlag = Exec_Method( BitMapCtrlID, "CAPTUREIMAGE", CaptureID )
Where "CaptureID" is the fully qualified name of the control to screenshot.
E.g.
If we have a form called TEST_CAPTUREIMAGE, with a BITMAP control called BMP_SCREENSHOT, then we can screenshot the contents of the IDE into it like so:
Call Exec_Method( "TEST_CAPTUREIMAGE.BMP_SCREENSHOT", "CAPTUREIMAGE", | "RTI_IDE" )
(N.B. The captured image you see displayed above is scaled - the screenshot is stored at full resolution in the control itself)
One obvious use for this is for support purposes, e.g:
- Take a screen-shot with CAPTUREIMAGE.
- Use The SAVETOFILE method in the IMAGE API to save it to a file.
- Create an email message with the image file attached or embedded and send it to your support desk.
We're sure you can think of more.
Bonus trivia:
- CAPTUREIMAGE works with any object that supports the Windows WM_PRINTCLIENT message.
- BITMAP controls are basically an alias for STATIC controls, so all STATIC controls support this method.