#define _CRT_SECURE_NO_WARNINGS
#include
#include
using namespace std;
int main()
{
HGLOBAL hGlobal;
wchar_t* pString = L"中华人民共和国万岁万万岁!";
wchar_t* pGlobal;
hGlobal = GlobalAlloc(GHND | GMEM_SHARE, (lstrlen(pString) + 1) * sizeof(wchar_t));
pGlobal = (wchar_t*)GlobalLock(hGlobal);
lstrcpy(pGlobal, pString);
GlobalUnlock(hGlobal);
OpenClipboard(GetDesktopWindow());
EmptyClipboard();
SetClipboardData(CF_UNICODETEXT, hGlobal);
CloseClipboard();
return 0;
}