[Migrated content. Thread originally posted on 19 January 2011]
Most of us working with software have often had the desire to see what the customer see. Granted, there are many alternatives for remote desktop today, but then there is the issue about having the same type of tool and the always problematic firewalls.One easy way around this, may be the image capture feature of the library function W$BITMAP. Add the HOT-KEY feature and you would promptly have a nice tool to improve support.
Assume you have application Cool, and you have a configuration file for this application. To this application add the following line:
KEYSTROKE HOT-KEY=SupportScreen ^P
What this does, is to tell the runtime that whenever a Ctrl P is pressed by the user, invoke the program SupportScreen. If you already use the Ctrl P for something, you are free to select any other key as hot key. Look up the documentation on configuring your terminal for other keystrokes.
The program SupportScreen, looks like this:
IDENTIFICATION DIVISION.
PROGRAM-ID. SupportScreen.
| Copyright (c) 2011 by Micro Focus. Users of Extend
| may freely modify and redistribute this program.
WORKING-STORAGE SECTION.
77 OPENSAVE-STATUS PIC S99.
88 OPENSAVE-OK VALUE 1.
COPY "ACUGUI.DEF".
COPY "OPENSAVE.DEF".
PROCEDURE DIVISION.
MAIN-LOGIC.
INITIALIZE OPENSAVE-DATA
MOVE "Bitmap files (*.bmp)" TO OPNSAV-FILTERS
MOVE "bmp" TO OPNSAV-DEFAULT-EXT
MOVE OPENSAVE-PATHMUSTEXIST TO OPNSAV-FLAGS
CALL "C$OPENSAVEBOX" USING
OPENSAVE-SAVE-BOX
OPENSAVE-DATA
GIVING OPENSAVE-STATUS
IF OPENSAVE-OK
| Capture the active window, client area only, 8 bit colors:
CALL "W$BITMAP" USING WBITMAP-CAPTURE-IMAGE
OPNSAV-FILENAME 0 1 8
GIVING OPENSAVE-STATUS
IF OPENSAVE-STATUS > 0
DISPLAY MESSAGE BOX
OPNSAV-FILENAME
TITLE "Capture successfull"
TYPE 1
ICON 1
ELSE
DISPLAY MESSAGE BOX
OPNSAV-FILENAME
TITLE "Error storing image"
TYPE 1
ICON 3
END-IF
END-IF
GOBACK
.Now, compile this program and add it to your application suite, note the dependency on the standard copybooks acugui.def and opnsave.def. They should be available in the def subdirectory of your Extend installation.
Make sure the new entry is in the configuration file and run the cool application. Press Ctrl P anywhere and a file save dialog should appear. Select a directory and a name and press OK.
A snapshot of your application should now be found in the directory of your choice and at the name you selected.
Obviously, we need to get the image to us, don’t we? Well, that is another story :-).
Note the limitation of OPNSAV-FILENAME, the full path of a filename may not be longer than 256 bytes.



