SWF in WPF WebBrowser control - Auto accept camera/microphone access? - wpf

I have an application with a WPF WebBrowser control which displays a Flash file. The flash file is used for WebCam/Microphone chat. At the moment, everytime the flash is loaded it displays a dialog box asking for permission to use the microphone and camera.
How can I fake a click on the allow button to stop hassling users with this question?
Its obviously not possible natively within flash or the WebBrowser, but I think I can send events/messages to the ActiveX object in the WebBrowser control.

You would have to author a full, native ActiveX control. The managed code is going to be sandboxed, and unable to make any P/Invoke calls.
Also, I suspect/wonder if in the case of protected mode IE7/8, if even the trick of using a Full ActiveX control + SendKeys (or the other equivalent of this) would fail.
Note, that at a very basic level, you're trying to circumvent the security policy of flash -- which at the end of the day, is just bad form.

if you have administrator permissions you can share this file on the local machine and then navigate to it, this will ask for the user's permission, I tried that, but this was on internal application and I had full access to all the infrastructure, make sure you navegate using the IP addess , file://127.0.0.1//ShareFolderName/file.swf , and don't use the machine name or the localhost
this should help if you don't have any problem shearing that files

Related

How to prevent XBAP Browser application from being closed in a web browser

We are developing a WPF application with a XBAP part running in a web browser, both using Caliburn.Micro framework.
There are no problems with implementation and deployment except that there is a requirement the application should not allow user to close it when instantly when some data was modified on the active window and user did not press save.
In the desktop application it is just easy as overriding Caliburn's CanClose method which itself is a part of Window.Closing callback. This callback is executed and CancelEventArgs.Cancel can be set if necessary.
In the XBAP application, Application.Current.MainWindow is a RootBrowserWindow and when it's Closing and Closed events are subscribed, these never get called even if callback is a static method (I'm modifying Caliburn.Micro code here for testing).
My question is how to prevent WPF XBAP browser application running in Internet Explorer from closing when user tries to close the tab or a whole browser window? Application trust is not an issue as we can (and will) ask clients to give full trust for the app.
Sorry to my knowledge, you can't, IExplorer restrictions. You are not even allowed to check if your window is minimized and even certain key combos isn't allowed in XBAP applications. Fulltrust or not, IE issue :(
I thinkered with the same issue as you about 3-4 years ago, + some keybindings, did alot of interop stuff, to no avail from what I can remember.
Cheers
Stian

WebBrowser: How to automatically allow activeX content

I have a problem where I am opening a set of html files found on the local computer which use ActiveX controls.
The constant notification popup is frustrating as every page it appears.
I cannot change the file as it is generated by an external application and I do not want enable ActiveX controls for IE in general.
What I would like to do is allow my webbrowser control, embedded in a WPF window, to allow blocked content automatically if it is from the local computer (or at the very least any blocked content as I can control what my webbrowser control can and cannot open)
I cannot see any obvious way of doing this, there are no options to allow blocked content and no event for identifying when blocked contetn has been foud.
Is there any way to achieve this?
Thanks
EDIT -
There have been plenty of views for this question but not a single comment. I will welcome any suggestions, perhaps even an alternative control, I realise the default WebBrowser is not ideal. Are there any other browsers that do offer this feature?
To add a little detail to the problem I think I should explain the requirements some more:
The resource being displayed is a set of html files that are generated as a report by a legacy tool that cannot be changed.
The tool I have built will allow the user to define the destination for the report and then allow them to browse it using an embedded browser.
I really just need a control that will render html and ActiveX controls as a browser would but without any interference from internet security settings.
UPDATE - Unfortunately I am no longer working on this project, however I am interested in the problem/fix so I shal try and replicate it in my spare time.
I have also renamed the question as I realise the problem I am dealing with specifically is ActiveX content, which may have a solution (see answer from Rajesh) which is specific to this type of content.
You need to add the file location to your trusted sites. This is possible either with a webserver running on your local machine or if the folder where they are located is a shared folder.
In IE, go to Internet Options > Security, select "Trusted Sites" and click the "Sites" button. Enter the location (i.e. file:\server-Hostname\Sharedfolder* for a shared folder) and click "add" (make sure that the "Require server verification (https:)..." option is unchecked).
There is a lot more information available if you search "Add local file to trusted sites" on the web. I do seem to recall adding a local file location without having to share the folder, but at the moment I don't remember how I did it.
Simply add this line to your html page at the start before the html tag.
< saved from url=(0023)http://www.contoso.com/
and then select and comment it.

How to stream a WPF window content to another computer

Does anyone know how a WPF window's view area can be streamed to remote computers? e.g. Can someone use a web browser and point to an address whereby this address shows the content of this WPF application?
This is somewhat like maybe desktop sharing but just over a small estate, which is the window's viewable area.
Well you didn't really explain what exactly you trying to accomplish which makes it hard to understand.
"Streaming" the content of window comes in a few flavors and has limited uses.
Typically its way more efficient to share data not how it presented. That said here are some common ones.
For example Cicso's WebEx allows you to share your desktop or a single application in the context of a conference call.
Citrix XenApp allows you to deliver an applicaiton to a client that's installed on the server (thin client).
You could also use Windows Media Encoder (which has an SDK) to capture an encode the contents of an application. However this is usually done as part of a demonstation and not in a "live context"

Keyboard Controls?

Hello World I am creating a financial software working on a touch panel machine. I have created a Keyboard control for User Input. I want to open start menu on my keyboard's Window button click. How's that possible?
you can't send keystrokes from a Silverlight app to the OS, neither can you execute shell operations. Just remember that SL apps run in a browser. If you were able to do things like simulating keystrokes etc., that would be a serious security issue.
Cheers, Alex
Silverlight does not allow you to directly send commands to the OS, as it runs within a secure browser sandbox. Even when the application is running out-of-browser, the majority of the security restrictions remain.
There are workarounds, however. The simplest of these is to implement a service or native application that can execute the commands, and then connect to it from your Silverlight application with a TCP socket or similar.
I haven't used it but Silverlight 4 has COM interop for out of browser applications. Maybe you can use that. If not directly then another application or service can be installed with a COM api and the SL4 application can send commands to it and that in turn sends keystrokes.
Here is some idea on how to do it.
http://elegantcode.com/2010/02/20/silverlight-4-com-interop-and-the-cool-stuff-you-can-do-with-it/

Can Silverlight HyperlinkButton forced to open page with Internet Explorer?

Can Silverlight HyperlinkButton forced to open page with Internet Explorer?
If someone has defaulted to one browser (let say Chrome), you cannot ask the current browser (using JavaScript) to open the link to a specific browser (i.e. you want Internet Explorer instead of Chrome). I am not sure about Flash or Silverlight's ability to do what you want.
I have found a technique but it is specific to VBScript inside Excel and it may need the UA agent check to make sure it works correctly for a target environment if you want to adapt the similar code in Silverlight:
http://www.mofeel.net/87-microsoft-public-excel/30085.aspx
With HyperLinkButton you can't. If your OOB app is in full trust mode you can use automation object InternetExplorer.Application to open and control IE.
If you have the right permissions in silverlight you can read and wright to disk. So yes you can.

Resources