Copying Embedded Bitmaps to the Clipboard

Users might want the ability to copy bitmaps from your title to the Windows Clipboard so they can use the bitmaps in their own documents. They can copy bitmaps from extended windows by using the standard Windows CTRL+INS key sequence. However, this method does not work for embedded windows.

To allow users to copy bitmaps from embedded windows to the Clipboard, include a copy-bitmap command at a suitable location. (For example, you might want to create a hot spot that copies the bitmap and put a “Click here to copy bitmap” label next to the hot spot.)

The copy-bitmap command has two parts:

A word, phrase, or bitmap formatted as double-underline text that serves as the activation point for the command

The copy bitmap command formatted as hidden text

The copy-bitmap command has the following syntax:

!CopyBmp(hwndContext, qchPath, "bitmapfile")

The bitmapfile is the name of the bitmap you want copied surrounded by double quotes (“ ”). Make sure to include the path from the project directory to the bitmap. Any backslashes in the path must be escaped with a backslash (\). That is, you must type any backslash (“\”) in the path as a double backslash (“\\”).

·To code a copy-bitmap command:

1.Display the topic in which you want to insert the copy-bitmap command. (This topic doesn't have to be the topic in which the bitmap is displayed.)

2.Select the text or bitmap reference you want to serve as the activation point.

3.From the Format menu, choose Character and select the Double Underline check box, then cancel the selection of the reference.

4.From the Format menu, choose Character again and clear the Double Underline check box, then select the Hidden check box.

5.Type the copy-bitmap command.

6.From the Format menu, choose Character again and clear the Hidden check box.

The following example makes the reference bitmap USCLIP.BMP the hot spot for a command that copies AZ_BIRD.DIB to the Clipboard:

!CopyBmp(hwndContext, qchPath, "dibs\\az_bird.dib") 

Inside the Project File

You must now register the copy bitmap command by placing the following entry in the [CONFIG] section of the title's project file:

[CONFIG]
RegisterRoutine("mvbmp","CopyBmp","v=USS")

Make sure you type the entry exactly as shown here. You only need one entry, regardless of the number of copy-bitmap commands in your title.