I'm currently developing a silverlight application with prism. From this application I need to be able to send a command or keystro开发者_StackOverflowkes to a client-side application. What is the best way to accomplish this?
Things I'm considering:
Javascript can use an ActiveX object to use DDE. (Limits to IE only)
Javascript can interact with a java applet to use DDE. (Have to deal with signing the applet appropriately)
Silverlight 4 can access COM objects if running Out of Browser. (I would like to avoid running out of browser)
Are there any other options that I am overlooking?
In addition to the other suggestions, if you use something like Firebreath to develop the sort of ActiveX control you mention above, you get an effectively identical NPAPI interface for your control for free. This would allow you to create one control in native (C++) code that would then work across all major browsers; and you could then talk to that control from Silverlight via its JavaScript bridge. Of course, any application that depends on sending keystrokes to another application is going to be pretty brittle, so you'll have to design your interface pretty well to ensure that things don't go suddenly haywire on you when the other application you're controlling hiccups.
It's an overkill but if the client application is under your control you could just host a small http container and post to localhost:port from Silverlight :)
Try using a WCF Duplex service
Pushing Data to Silverlight from WCF Duplex Service
精彩评论