如何将箭头键发送到 Delphi TWebBrowser 控件内的 Adobe Flash Player?
我正在 Delphi Pro 6 表单 (TForm) 中使用 TWebBrowser 控件来查看 YouTube 的“leanback”界面页面上的 YouTube 视频。我想将箭头键发送到正在播放视频的 Flash Player,但我似乎无法让它工作。我尝试过使用 SendKeys,但我的猜测是我无法将击键事件获取到 Flash Player 本身。我尝试将按键发送到 TWebBrowser 控件的窗口句柄,但没有任何反应,即使在将输入焦点设置到它之后也是如此。我尝试了 TWebBrowser Handle 属性和 HWND 属性,Delphi 帮助文档建议将后者与 Windows API 调用一起使用。正如我所说,Handle 属性不会导致任何明显的操作,当我尝试 HWND 属性时,我从 TWebBrowser OLE 接口代码中收到“未指定的错误”。
任何人都可以想出一种方法来完成这项工作吗?或者如果没有,有一种方法可以通过 Delphi 代码或注入的 Javascript 获取 Adobe flash 播放器的窗口句柄吗?或者也许是一种使用 Javascript 与 Flash Player 对象对话并让箭头键工作的方法?
谢谢。
I am using a TWebBrowser control inside a Delphi Pro 6 form (TForm) to view a YouTube video on YouTube's "leanback" interface page. I want to send arrow keys to the Flash Player that is playing the video but I can't seem to get it to work. I've tried using SendKeys but my guess is that I am unable to get the keystroke events to the Flash Player itself. I've tried sending the keys to the TWebBrowser control's window handle but nothing happens, even after setting input focus to it. I tried both the TWebBrowser Handle property and the HWND property, the latter of which is recommended by the Delphi Help documentation to use with Windows API calls. The Handle property as I said results in no apparent action and when I try the HWND property I get an "unspecified error" from the TWebBrowser OLE interface code.
Can anyone think of a way to make this work? Or if not, a way to get the Adobe flash player's window handle via Delphi code or injected Javascript? Or perhaps a way to use Javascript to talk to the Flash Player object and get the arrow keys working?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试本页底部的解决方案:
http://www.delphipages.com/forum/archive/index .php/t-197180.html
Try the solution at the bottom of this page:
http://www.delphipages.com/forum/archive/index.php/t-197180.html