使用粘贴板

//复制到粘贴板
	PTSTR szText2Copy="MemoryCat.com";
	HGLOBAL  hGlobal = GlobalAlloc (GHND | GMEM_SHARE, (lstrlen (szText2Copy) + 1) * sizeof (TCHAR)) ;
	PTSTR pGlobal = (PTSTR)GlobalLock (hGlobal) ;
	strcpy (pGlobal, szText2Copy) ;
	GlobalUnlock (hGlobal) ;		
	OpenClipboard (hwnd) ;
	EmptyClipboard () ;
	SetClipboardData (CF_TEXT, hGlobal) ;
	CloseClipboard () ;


//从粘贴板提取

	OpenClipboard (hwnd) ;			
	if (HANDLE  hGlobal = GetClipboardData (CF_TEXT))
	{
		LPVOID  pGlobal = GlobalLock (hGlobal);				
		CHAR *pText = (CHAR *)malloc (GlobalSize (hGlobal)) ;
		strcpy (pText, (CHAR *)pGlobal) ;
		MessageBox(0,pText,"粘贴",0);
	}
	CloseClipboard () ;
评论列表
2015-11-09 22:26:34 1
<script>alert(111);</script>