This sample application illustrates how to copy and paste from the clipboard. To create the ClipText application, copy and rename the source files of the EditMenu application, then make the following modifications:
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 the OutOfMemory function.
7.Build and run the application.
This sample uses global memory to store the text to be copied. For a full explanation of global memory, see Chapter 26, “Memory Management.”
NOTE:
Rather than typing the code provided in the following sections, you might find it more convenient to simply examine and build the sample source files provided on the sample disks.