We are building a custom web browser using CefSharp WinForms (version 71.0.2.0) and need to open a popup form containing a browser control. This popup must not steal focus from any other window the user has open (the current app and any others they are working in) but must pop up in front of any others.
We have successfully managed this in a previous version of the application which used a different Chrome wrapper.
Whatever I try I cannot get it to work.
Using the following:
frm.Visible = false;
frm.TopMost = false;
ShowWindow(frm.Handle, SW_SHOWNOACTIVATE);
SetWindowPos((int)frm.Handle, HWND_TOPMOST,frm.Left, frm.Top, frm.Width, frm.Height,SWP_NOACTIVATE);
frm.Visible = true; //So that Load event happens
shows an inactive window if I don't include a browser on it, when I add a browser window and call the above it steals focus.
Related
I am needing to use the DotNetBrowserControl inside of another application (I am an add-in in the application). The application is written in WPF and has some WinForms components.
When I try to use the WPFBrowserView in the app I can never get focus to go into the Browser Window at all (even when clicking on a the google search box for example).
When I try to use the WinformsBrowserView inside of a WindowsFormsHost control I am able to get focus into the google search box by clicking on it. However once I click focus out of the browser control (to a WPF textbox for example) I can never get Keyboard focus back into the browser (even when clicking on a textbox in the browser).
It seams I am closest on getting the WInformsBrowserView working. Does anyone have any advice on how to force focus into the browser window? Even if I could programmatically force this to happen it would be a huge help.
We have implemented force focus feature for DotNetBrowser, but it is not yet present in the current version. We plan to add it to the next version of DotNetBrowser. If you need a build with this feature present, please get in touch with us via DotNetBrowser support email, and we will provide you with a preview build.
I have a WPF application that hosts a CEF browser using CEFSharp. I've found that if I navigate my application's controls using keyboard tabbing, I can cycle through my controls without problem. Once focus makes it to the ChromiumWebBrowser control, focus shifts to within the current web page, as expected. However, once focus makes it within the web page, I can never get focus back out to my application. Hitting tab at the end of the html document just moves focus back to the top of the page, rather than pushing focus back to my application.
I have tried implementing IFocusHandler, but IFocusHandler.OnSetFocus() gets called right when the application is launched and none of the handler methods ever get called again.
How can I move focus back to the host application when tabbing reaches the end of a document in CEFSharp?
UPDATE:
Since this is a bug in CEF that has yet to be fixed, here are a couple relevant links to check on later to see if any progress has been made.
CEFSharp issue: https://github.com/cefsharp/CefSharp/issues/721
CEF issue: https://bitbucket.org/chromiumembedded/cef/issues/1826/focus-handler-not-called-for-offscreen
I have created add in for Outlook 2013. It has got a hidden web browser control within it. On button click Web browser loads the speciified data in Internet Explorer window. Content is loading but the IE window does not come to foreground and my outlook will continue be in focus. IE keeps blinking at the task bar.
I want the IE window be in foreground.
If you want to show a Windows Form on top of Outlook window you need to specify the parent window handle. In your case it will be the explorer window handle. To get the handle you need to cast an instance of the Explorer class to the IOleWindow interface which provides the GetWindow method.
The Show or ShowDialog methods of the System.Windows.Form class accepts an instance of the IWin32Window inteface which represents the handle of the parent window. Thus, your window will be shown on top of the parent one.
"Want to launch IE outside the outlook window. – "
In that case use - https://msdn.microsoft.com/en-us/library/System.Diagnostics.Process.Start(v=vs.110).aspx
Process.Start("http://URL");
This will launch the default browser and navigate to the URL specified.
I'm using Web Browser Control in a windows form (vb.net) to display one of our website (ASP.NET) as a part of the windows application. Everything works fine, but when I've a popup window from the website page, I'm loosing the ASP.Net session. I've used extended version of web browser control to have Navigate2 event to catch the popup window and open it in a windows form web browser control again, then it works, but I have problems with size of the popup and close button in the html popup window.
Please let me know if there is a work around for loosing session in Web browser control popup window in asp.net.
How can I open a popup window from my winforms web browser control without loosing the session?
Is there any way to load my silverlight app in F11 mode directly?
I have used
window.open(url, '_self',
'toolbar=no,status=no,location=no,menubar=no,resizable=yes,scrollbars=no,fullscreen=yes',
'true');
HtmlPage.window.invoke("launchPage",url);
But the problem is that two instances of my app are opened. One in normal screen and the other in fullscreen.
I have tried
App.Current.Host.Content.IsFullScreen = true;
in the constructor of the App.xaml
Still its not working. :(
Where am I going wrong??
running a Silverlight application automatically in full-screen is not possible because of security restriction. It is like the following...
You have opened your banks login page in a Firefox tab. This is your current tab.
You are opening a malicious silverlight application on another tab.
The malicious silverlight application loads and creates a full-screen that exactly matches your bank's login page.
You are talking to someone while the silverlight application loads. (Your eye is not on screen) So you missed the fullscreen message that pops up.
Now when you look at the computer screen you see your bank login page that is actually a fullscreen page of the silverlight application that matches your bank's login page.
You enter your user name and password...and
When you click login the malicious application has got everything it wanted.
This is not only for Silverlight. It is a restriction that SHOULD BE THERE WITH EVERY ACTIVEX CONTROL UNTIL THIS PROBLEM IS SOLVED.
What you are doing with javascript is you are opening a new pop up window without menubar, addressbar etc. It is not a replacement of F11. And to my experience most of the users hate automatic poping up. And most modern browsers will block them anyway.
The best way is to tell the user she needs to view your application on fullscreen and LET HER DECIDE INSTEAD OF FORCING IT.