NOTE: This doesn't seem to necessarily apply to Silverlight only, I've read people have the same problems with Flash, so keep that in mind.
I'm trying to write a program that will control Netflix through my own buttons (for now, eventually it will be extended to a mobile remote control app), by sending hotkeys directly to it using the windows api.
- I am able to retrieve the actual window handle used by the Netflix Silverlight player.
- I am able to send keystrokes to specified window handles (using the
TranslateMessage
function in win api) - But I cannot, for some reason, get the netflix player to recognize any keystroke I send.
- I have tried using the
SetFocus
function in the win api before attempting to send keypresses and that doesn't help.
What I need to figure out, is why it's differentiating keys sent via api calls, from physical keyboard key presses.
Here's how I have things set up (window class names for reference):
Form1 (
开发者_如何转开发WindowsForms10.Window.8.app.0.33c0d9d
)WebBrowser Control (
Shell DocObject View
)HTML Page (
Internet Explorer_Server
)Embedded Silverlight player (
MicrosoftSilverlight
)
I was wondering if someone might be able to offer some suggestions. Thanks very much in advance.. hopefully someone can help get me through this.
I tried to send KeyEvents
to a flash application in C# (I wanted to 'hack' the griefing game called "CLOP").
I noticed this didn't work. I can however perfectly send KeyEvents
to the browser itself but the flash plugin seems to ignore these even after acquiring focus.
I suspect this isn't possible because of security measures.
I found the following thread here on StackOverflow that explained a bit more about this (this one is about flash as well) Send keyboard and mouse events to Flash Movie
精彩评论