1.使用CreateWindowExW创建控件,如
hEditWnd = CreateWindowExW(WS_EX_NOPARENTNOTIFY | WS_EX_CLIENTEDGE, L"Edit", NULL, WS_VISIBLE | WS_CHILD | WS_BORDER | WS_TABSTOP | ES_AUTOHSCROLL, 0, 0, 300, 24, m_hWnd, (HMENU)IDC_UNICODE_EDIT, NULL, NULL);
2.在焦点进入Edit控件时,进入自己的消息泵,此消息泵使用GetMessageW,DispatchMessageW来完成消息分发.
m_bStopMonitorUnicodeEdit = false;
for(;;)
{
if(m_bStopMonitorUnicodeEdit)
break;
MSG msg = { 0 };
BOOL bRet = ::GetMessageW(&msg, NULL, 0, 0);
if(bRet == -1)
{
continue; // error, don't process
}
else if(!bRet)
{
break; // WM_QUIT! exit message loop
}
::TranslateMessage(&msg);
::DispatchMessageW(&msg);
}
4.在焦点退出Edit控件时, 退出消息泵.
m_bStopMonitorUnicodeEdit = true;
Reference:
在网络上查过资料,那些回答都是垃圾,连问题的根源都没摸著边.