用CHtmlView做浏览器web编辑器中无法输入回车的问题?难道就没人做过浏览器,遇到这个问题?!!!
当载入的页面中含有设为编辑模式的div或者iframe,
则无法输入回车!!!
确实有这个问题。下了微软的那个MFCIE的例子也是这样。
没有人做过浏览器么?没碰到这个问题?
问题点数:100、回复次数:5Top
1 楼debehe(躯壳)回复于 2006-03-18 00:30:08 得分 0
获取不到事件?
http://www.mctainsh.com/COM/HtmlCtrlEvents.aspx
http://support.microsoft.com/kb/q253915/Top
2 楼coolzdp7(fds)回复于 2006-03-20 20:01:29 得分 0
快捷键能获取!
难道就没人遇到过么?Top
3 楼jiangsheng(蒋晟.Net[MVP])回复于 2006-03-21 07:40:48 得分 100
Short answer: override PreTranslateMessage as follows
BOOL CIEAutomationView::PreTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
if (pMsg->message == WM_KEYDOWN && (pMsg->wParam == VK_RETURN ||
pMsg->wParam == VK_ESCAPE))
{
::TranslateMessage(pMsg);
}
return CHtmlView::PreTranslateMessage(pMsg);
}
Long answer: I don't know why this works.
The problem occurs only when MFCIE runs a DHTML editor and the editor has the focus. Otherwise CHtmlView correctly intercepts keystrokes even though the PreTranslateMessage() trick is absent.
http://www.microsoft.com/mind/0499/faq/faq0499.asp suggested calling Win 32 API IsDialogMessage(), which is even worse. The problem is that the enter key got eaten in some cases, but not in all cases as described in the article. IDocHostUIHandler::TranslateAccelerator is called and get ignored somewhere inside the message handler only when the editor has the focus.Top
4 楼coolzdp(unreal张师傅)回复于 2006-03-21 09:15:26 得分 0
Thanks!
蒋老大就是牛!
我昨晚下个MYIE早期的源代码看,它并没有这样做。
不过也解决了这个问题!
我对com不熟,也看不懂一些地方。
不过解决了就好。慢慢学习吧呵呵!
Top
5 楼jiangsheng(蒋晟.Net[MVP])回复于 2006-03-24 07:43:01 得分 0
update: This program does not exist in MFC7.0.Top




