How To Do A Screen Dump

A "screen dump" is also known as a "screen shot". It is a copy of the output to the screen.

Screen dumps are important documentation. When inspecting the source code of a program, it helps to better understand the program if the inspector can see what the output looks like.

There are at least three types of output that we may want to copy. You use different methods capture a screen shot for each type of output.

  1. Textual Output: produced by cout (C++) and System.out.print (Java).
  2. Graphics Output: produced by drawing functions such as found in BGI (Borland Graphics Interface).
  3. Dialog Boxes: produced by GUI libraries such as generated by Java's AWT and Swing classes.

Textual Output

  1. Execute the program.
  2. Simultaneously press the [Alt] and [Enter] keys. The DOS-type screen must fill the entire screen.
  3. Press the [Print Screen] key. This will copy the pattern on the screen to the clipboard.
  4. Simultaneously press the [Alt] and [Enter] keys. The DOS-type screen resumes its former window status.
  5. Focus the edit window which contains the source code. (Click on it to make it "come alive".)
  6. Move the cursor two lines below the last line of the source code.
  7. Simultaneously press the [Ctrl] and [V] keys. This will paste the output pattern starting at the cursor.
  8. Delete all blank lines that may appear below the output pattern. Leaving the blank lines may cause an extra page to be used when printing the source code listing which now includes the output pattern.
  9. Place an opening multi-line comment symbol (/*) on the line above the output pattern.
  10. Place an closing multi-line comment symbol (*/) on the line below the output pattern.
  11. Label the screen dump on the line containing the opening comment symbol. Type "Screen Dump".

Check out the following example of a program with a screen dump.


#include <iostream>
#include <cstdlib>

using namespace std;

int main()
{
      cout << "This is the output that we want in the screen dump.";
      cout << endl << endl;
      system("PAUSE");
      return 0;
}

/*        Screen Dump

This is the output that we want in the screen dump.

Press any key to continue . . .

*/

Graphics Output

While text output to the clipboard copies to a text editor, graphical output must be copied to software that can handle graphics output. Notepad cannot handle graphics output but Wordpad can!

Do not automatically copy graphical output to the editor containing your source code because it will contain a white image on a black background. This will consume gobs of toner when you print the source code containing the graphical screen dump. An extra step is needed when copying a graphical screen dump to a source code listing.

After copying the graphical image to the clipboard but before further copying the clipboard to the source code, convert the graphical image to a "negative image" in a paint program such as Paint Shop Pro.

For example; after the graphical image is copied to the clip board:

  1. Launch Paint Shop Pro version 5.
  2. Click on [Edit], then [Paste As New Image].
  3. Click on the [Magnify] icon, which looks like a magnifying glass.
  4. Left mouse click once on the Paint Shop Pro window containing the image. (This will increase the size so you can comfortably inspect the image.)
  5. Click on the "Selection" icon, which looks like a rectangle.
  6. Use the mouse to drag a rectangle around the relevant part of the image. (Press the left mouse button and drag the rectangle from the top left corner to the bottom right corner surrounding the desired output.)
  7. Select only the output that you want. Click on [Image], then [Crop to selection].
  8. Convert the white on black image to a black on white image. Click on [Colors], then [Negative Image].
  9. Copy the source code to software that can hold a graphical image. WordPad can do this.
  10. If copying the source code to an editor that uses proportional fonts, select a non-proportional font such as Courier New so that the indentations in the source code will remain "straight".
  11. Copy the converted image to the clipboard. Click on [Edit], then [Copy].
  12. Focus the software window which contains the source code, such as WordPad. (Click on it to make it "come alive".)
  13. Move the cursor two lines below the last line of the source code.
  14. Simultaneously press the [Ctrl] and [V] keys. This will paste the output (graphical) image at the cursor.
  15. Delete all blank lines that may appear below the output pattern. Leaving the blank lines may cause an extra page to be used when printing the source code listing which now includes the output pattern.
  16. Place an opening multi-line comment symbol (/*) on the line above the output pattern.
  17. Place an closing multi-line comment symbol (*/) on the line below the output pattern.
  18. Label the screen dump on the line containing the opening comment symbol. Type "Screen Dump".

You may now print the source code together with it's accompanying graphical screen dump.

Check out the following example of a graphical program with a screen dump.


#include <winbgim.h>
#include <cstdlib>

int main()
{
 // Set the graphics mode

    initwindow(400,300);

   // Draw the two-headed arrow

	moveto(30, 30);
	lineto(180, 30);
	moveto(30, 30);
	lineto(60, 0);
	moveto(30, 30);
	lineto(60, 60);
	moveto(180, 30);
	lineto(150, 0);
	moveto(180, 30);
	lineto(150, 60);

   // Draw the two-tailed arrow

	moveto(30, 100);
	lineto(180, 100);
	moveto(30, 100);
	lineto(0, 70);
	moveto(30, 100);
	lineto(0, 130);
	moveto(180, 100);
	lineto(210, 70);
	moveto(180, 100);
	lineto(210, 130);

   // Label the drawing

	moveto(0, 250);
	outtext("The Muller-Lyer illusion");

   // Pause for a key to be pressed

      moveto(200, 300);
      outtext("Strike any key to continue");
      while(!kbhit());

   // Close the graphics mode

      closegraph();
      return (0);

}  // end main

/*        Screen Dump

        
*/

Dialog Box Output

Simultaneously pressing [Alt][PrtScn] will copy the Dialog Box to the clipboard from whence you can paste it just below your source code. You must paste it in an application such as a wordprocessor that accepts graphical images.


[Home of Gerry Donaldson's Com Sci Gate       
[Gerry Donaldson's Email Address]
csgate@donaldson.org
[EFC Blue Ribbon - Free Speech Online]

URL:   http://www.donaldson.org/    Last Revised:   February 24, 2002.