case IDM_COPY:                    if (hText != NULL) {                        /* Allocate memory and copy the string to it */                        if (!(hData 
                             = GlobalAlloc(GMEM_DDESHARE, GlobalSize (hText)))) {
                            OutOfMemory();
                            return (TRUE);
                        }
                        if (!(lpData = GlobalLock(hData))) {
                            OutOfMemory();
                            return (TRUE);
                        }
                        if (!(lpszText = GlobalLock (hText))) {
                            OutOfMemory();
                            return (TRUE);
                        }
                                    strcpy(lpData, lpszText);
                        GlobalUnlock(hData);
                        GlobalUnlock (hText);                        /* Clear the current contents of the clipboard, and set
                         * the data handle to the new string.
                         */                        if (OpenClipboard(hWnd)) {
                            EmptyClipboard();
                            SetClipboardData(CF_TEXT, hData);
                            CloseClipboard();
                        }
                        hData = NULL;                                    if (LOWORD(wParam) == IDM_CUT) {
                            GlobalFree (hText);
                            hText = NULL;
                            EnableMenuItem(GetMenu (hWnd), IDM_CUT, MF_GRAYED);
                            EnableMenuItem(GetMenu(hWnd), IDM_COPY, MF_GRAYED);
                            InvalidateRect (hWnd, NULL, TRUE);
                            UpdateWindow (hWnd);
                        }
                    }                    return (TRUE);