描述:
我用MFC ActiveX Wizard生成一个最简单的OCX框架,在其中插入一个Dialog,包含两个Edit,Button。
在ActiveX控件的Create函数中创建这个Dialog,当我在网页中引入这个OCX后,
我dialog上的Edit对键盘的Backspace,left,right按键失效了,但是对其他输入和del有效。
我参考了http://www.microsoft.com/mind/0499/faq/faq0499.asp
但还是没有解决问题,上司不停在催我,混不下去了!
请大家帮一把!
<html>
<head>
<title>dialogcontrol</title>
</head>
<body>
<center>
<object id="dialogcontrol" classid="clsid:371EA21B-CD61-4E9B-88D3-1D83BEFBB0F6"
height=300 width=500>
</object>
</center>
</body>
</html>
解决方案1:
Accelerator keys, such as ARROW keys, are first received by the message pump of the ActiveX control's container. Even if the control has the focus, it does not receive messages for keystrokes that have special meaning to control containers, such as ARROW and TAB keys. MFC ActiveX controls have a chance to intercept these messages by overriding their PreTranslateMessage function.
However, PreTranslateMessage is not always called for an MFC ActiveX control.
RESOLUTION
Install a Windows WH_GETMESSAGE hook for the modeless dialog box/propertysheet derived class to allow it to intercept keystrokes and handle accelerators.
...
Q168777 PRB: MFC ActiveX Control in IE Doesn't Detect Keystrokes
Q180402 PRB: MFC ActiveX Control Ignores ARROW Keys on VB Container
Q187988 PRB: ActiveX Control Is the Parent Window of Modeless Dialog
Q199431 PRB: Enabling Menu Mnemonics in an MFC ActiveX Control
Q194294 HOWTO: Add Toolbars and Tooltips to ActiveX Controls