Web 浏览器控件放置在 Outlook 插件内时不接收 Tab/Delete/Back 键
我正在构建一个公开自定义任务窗格的 Outlook 加载项。在此窗格中,根据某些用户操作,
- 我创建一个新的 UserControl(其中包含 WebBrowser 控件)
- 获取 Outlook 消息窗口(使用 Win API FindWindow("rctrl_renwnd32" ...) )
- 将消息窗口大小调整为 0 宽度
- 将我的 UserControl 的父级设置为主 Outlook 资源管理器窗口(使用 Win API User32.SetParent)
- 设置我的 UserControl 的大小以占据消息窗口的位置
一切都很好,除了 Outlook 占用了删除/后退/制表键(而且我确信还有更多),从传递到控件。
在此用户控件中,我启动了一个内部站点,该站点要求用户执行登录。 Web 浏览器接受常规输入,但当按下 Tab/Delete/Back 键时不执行任何操作!
我已经无计可施了!我已经在网上搜索了几个星期了,似乎不知道发生了什么。
有谁知道这里发生了什么以及如何解决它?我已经实现了一个低级键盘挂钩,并且能够捕获所需的按键。我尝试过使用 User32.PostMessage 但仍然没有运气。
谢谢, Harsha
p.s.:我有 Java 背景,所以对于 .NET 和 .NET 来说我还是个新手。 P/调用。
I am building an Outlook add-in which exposes a custom task pane. From this pane upon some user actions,
- I create a new UserControl (that has a WebBrowser control inside it)
- Get hold of the Outlook messages window (using Win API FindWindow("rctrl_renwnd32" ...) )
- Resize the messages window to 0 width
- Set the parent of my UserControl to the main Outlook explorer window (using Win API User32.SetParent)
- Set the size of my UserControl to occupy the messages window's place
Everything is good, except for the fact that Outlook chews away Delete / Back / Tab keys (and I'm sure that there are more), from being passed on to the control.
Inside this UserControl, I launch an internal site which requires the user to perform login. The WebBrowser accepts regular input, but does nothing when Tab / Delete / Back keys are pressed!
I am at my wits ends! I have been searching the net for a couple of weeks now and don't seem to know what is going on.
Does anybody know what is going on here and how to fix it? I have implemented a low-level keyboard hook and am able to trap the required keys. I have tried using User32.PostMessage but still no luck.
Thanks,
Harsha
p.s.: I come from a Java background and so I'm somewhat of a novice when it comes to .NET & P/Invoke.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
WebBrowser 控件使用 DLGC_WANTARROWS | 响应 WM_GETDLGCODE 消息。 DLGC_WANTCHARS。这就是为什么它不能处理某些键,例如 Tab、Back 和 Delete。它告诉家长不要处理这些钥匙。
您可以编写一个 Windows 挂钩,然后调用 Web 浏览器控件的 IOleInPlaceActiveObject ::TranslateAccelerator 实现。
有关详细信息,请查看 Microsoft Internet 开发人员 Scott Roberts 于 1999 年 4 月撰写的“WebBrowser击键问题”。
The WebBrowser control responds to the WM_GETDLGCODE message with DLGC_WANTARROWS | DLGC_WANTCHARS. That's why it won't handle certain keys such as Tab, Back and Delete. It told the parent to not handle those keys.
You can write a windows hook then call the webbrowser control's IOleInPlaceActiveObject ::TranslateAccelerator implementation.
Check "WebBrowser Keystroke Problems" by Scott Roberts, Microsoft Internet Developer April 1999 for more details.