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);
= 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);
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货