The "PrintScreen" key is handled directly by the OS and cannot be referenced in COBOL.
However you can write an isCOBOL program that could be run as hotkey program.
For example, this setting in your properties file will run the program PRINTSCREEN when the F7 key (which returns the exception-value 7) is pressed:
iscobol.hot_key.printscreen=7
You could also create a push-button in your GUI screen labeled "Print Screen" with an exception value (ex: 101) and associate that value to the hotkey variable:
iscobol.hot_key.printscreen=101
The PRINTSCREEN program should call the "W$CAPTURE" routine.
There are examples of capturing the desktop and the current window in the SAMPLES program (%ISCOBOL%\sample\issamples) in the library routines section, as well as a simpler sample in the isCOBOL documentation for "W$CAPTURE".
In order to print the screen programmatically, you would choose the printer and print the image file using WIN$PRINTER, specifically the WINPRINT-SETUP and WINPRINT-PRINT-BITMAP op codes.
See the WIN$PRINTER sample also in the Library routines section of the SAMPLES program as well as the documentation on WINPRINT-PRINT_BITMAP.
Article ID: 251
Created: September 14, 2015
Last Updated: May 25, 2022
Author: Support KB Author
Online URL: https://support.veryant.com/phpkb/article.php?id=251