views:

216

answers:

1

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.

A: 

Use WinAPI's keybd_event

dwrbudr