:: SendMessage( h ,WM_IME_CHAR ,( WPARAM)(0xBABA),0);
//发个汉字
// 发送字母.
if (!OpenClipboard (NULL))
{
return -1;
}
// Remove the current Clipboard contents
if(!EmptyClipboard ())
{
return -2;
}
// Get the currently selected data, hData handle to
// global memory of data
CString str = _T( "teststr");
size_t cbStr = (str. GetLength() + 1) * sizeof (TCHAR);
HGLOBAL hData = GlobalAlloc( GMEM_MOVEABLE, cbStr );
memcpy_s(GlobalLock (hData), cbStr, str .LockBuffer(), cbStr);
GlobalUnlock(hData );
str.UnlockBuffer ();
// For the appropriate data formats...
UINT uiFormat = (sizeof(TCHAR) == sizeof(WCHAR)) ? CF_UNICODETEXT : CF_TEXT;
if (::SetClipboardData (uiFormat, hData) == NULL )
{
CloseClipboard();
return -3;
}
CloseClipboard();
return 0;
SendMessage
PostMessage
PostThreadMessage