https://www.leanwind.com/archives/5791.html
HWND hWnd = NULL; OpenClipboard( hWnd );//打开剪切板 EmptyClipboard();//清空剪切板 HANDLE hHandle = GlobalAlloc(GMEM_FIXED, 1000);//分配内存 char* pData = (char*) GlobalLock(hHandle);//锁定内存,返回申请内存的首地址 strcpy_s(pData,1000,"this is a ClipBoard Test.");//或strcpy(pData, "this is a ClipBoard Test."); SetClipboardData(CF_TEXT, hHandle);//设置剪切板数据 GlobalUnlock(hHandle);//解除锁定 CloseClipboard();//关闭剪切板