Adobe Reader ActiveX 阻止加速器
我已将 Adobe Reader ActiveX 控件作为子窗口嵌入到 MFC 应用程序中,但如果 Reader 具有焦点,则不会触发我的 MFC 应用程序中定义的任何加速器,无论 Adobe Reader 是否使用它们。如果我使用相同的方法嵌入其他 ActiveX 控件,我可以毫无问题地检测我的加速器。
我使用 Visual Studio 2008 IDE 生成 Adobe Reader ActiveX 控件的包装器(默认情况下称为 CAcroAXDocShim)。在 WM_INITDIALOG 处理期间用于创建控件的代码是:
m_ctrl.Create(_T("PDF Viewer"), WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_TABSTOP, CRect(5, 5, 400, 300), this, 1001);
m_ctrl.LoadFile(_T("C:\\auslab\\test.pdf"));
控件具有焦点,我无法拦截键盘输入,方法是:
- 窗口出现,正确加载 PDF,并且工作正常,但如果ActiveX
- 在 CWinApp 派生类
- ActiveX 控件的父窗口的窗口类上的
- PreTranslateMessage处理 WM_SYSCOMMAND
事实上,我尝试在主 Window 消息循环中为我的按键的 WM_KEYDOWN 消息设置断点,但似乎从未命中ActiveX 控件获得焦点。我尝试在我的应用程序中使用键盘挂钩来覆盖控件的按键处理,但它似乎工作不可靠 - 它会运行一段时间,但经过一些交互后,键盘挂钩完全停止。
有什么想法吗?提前致谢。
I have embedded an Adobe Reader ActiveX control as a child window in an MFC application, but if the Reader has focus, none of the accelerators defined in my MFC application are triggered, regardless of whether they are used by Adobe Reader or not. If I embed other ActiveX controls using the same method, I have no problem detecting my accelerators.
I have used the Visual Studio 2008 IDE to generate a wrapper for the Adobe Reader ActiveX control (called CAcroAXDocShim by default). The code used to create the control during WM_INITDIALOG handling is:
m_ctrl.Create(_T("PDF Viewer"), WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_TABSTOP, CRect(5, 5, 400, 300), this, 1001);
m_ctrl.LoadFile(_T("C:\\auslab\\test.pdf"));
The window appears, loads the PDF correctly, and works fine, but I have not been able to intercept keyboard input if the ActiveX control has focus, either by:
- Using accelerators
- PreTranslateMessage on the CWinApp-derived class
- PreTranslateMessage on the window class of the parent window of the ActiveX control
- Handling WM_SYSCOMMAND
In fact, I tried to set a breakpoint on the WM_KEYDOWN message for my key in the main Window message loop, and it never seemed to be hit when the ActiveX control had focus. I have tried using a keyboard hook in my app to override the key handling of the control, but it seems to work unreliably - it will operate for a little while, but after some interaction, the keyboard hook stops entirely.
Any ideas? Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据下面的链接,“事件不会传递到容器。”
http://forums.adobe.com/thread/906756
according to the link below, "the events are not passed on to the container."
http://forums.adobe.com/thread/906756