if(::OpenClipboard(GetForegroundWindow()))
{
EmptyClipboard();
HANDLE hClip;
hClip=GlobalAlloc(GMEM_MOVEABLE,strlen("abc")+1);
char *pstr = reinterpret_cast<char*>(GlobalLock(hClip));
strcpy(pstr, "abc");
GlobalUnlock(hClip);
SetClipboardData(CF_TEXT,hClip);
CloseClipboard();
::SendMessage (hwnd,WM_PASTE, CF_TEXT,0);
}
//以上代码将 字符串 "abc"复制到粘贴板