13.3 Sample Application: ClipText

This sample application illustrates how to copy to and paste from the clipboard. To create the ClipText application, make the following modifications to the EditMenu application created in Chapter 7, “Menus”:

1.Add new variables.

2.Modify the instance initialization code.

3.Add a WM_INITMENU case.

4.Modify the WM_COMMAND case to process the IDM_CUT, IDM_COPY, and IDM_PASTE cases.

5.Add a WM_PAINT case.

6.Add an OutOfMemory function.

7.Compile and link the application.

This sample uses global memory to store the text to be copied. For a full explanation of global memory, see Chapter 15, “Memory Management.”