WebBrowser control inside IE - c#

I have a .NET ActiveX/COM Object which has a WebBrowser control (among other controls such has buttons, etc) inside it.
This object seems to load fine, the buttons are displayed and working but, for some reason, the WebBrowser control doesn't show up!
Is there some limitation for this in IE (e.g., is IE afraid of something recursive, etc.)? Is there a way that I can overcome it?
Thanks in advance,
Zubrowka

FireBreath has a library called WebView that does this; I've tested it both in NPAPI based browsers and in ActiveX and it works just fine. There are many reasons why you may want to do this.
Since I don't know what you're doing, I can't tell you what you're doing wrong... but I can show you the source code that FireBreath uses to do it:
https://github.com/firebreath/FireBreath/blob/master/src/libs/WebView/Win/WebViewWin.cpp
This is in C++, but you might be able to find something useful from it. I don't use .net in the browser -- too much overhead -- but theoretically the same principles should apply.

Related

Embedding native widget in Webkit view

This is something I've been trying to find out if it is possible and how to do it. I would like to be able to embed a Gtk+ control/widget within a Webkit view, integrated as part of the webpage. For instance, I was hoping that it could be possible to integrate a specific control in the middle of a programmatically generated webpage loaded onto a Webkit instance in a Gtk+ application. I'd like to make it a part of the DOM, if possible.
My intent is to use the webview as a basis for some parts of the UI, but there are some specific controls that needed to be the original Gtk+ ones.
When dealing with controls in forms, for instance, one of two things happen, either Webkit-gtk renders them explicitly to look like the Gtk+ controls, or makes use of actual Gtk +controls and embeds them. If the reality is the second case, then it might actually be easy to do it with other controls as well.
I'm developing the application in C# (mono) with GTK#, but I'm also hoping that if it is possible to do it directly in Gtk+, then it might eventually be possible to do in GTK#.
This used to be possible in WebKitGTK 1.x, but since WebKitGTK has become multiprocess, the capability has been removed.
However, you may be in luck, since GTK# uses quite old versions of libraries. I can't tell what version of WebKitGTK you're using, but if it has the create-plugin-widget signal then you should be able to do this.
I've never used this signal before, but I believe it works like this: you put an <object> tag into your HTML, and then the signal will be emitted when the webview needs to embed your widget. In the signal handler, you create your widget, and pass it as the return value of the signal handler.
You may want to look into Broadway. This is the web backend for GTK+, and uses HTML5 to display GTK+ widgets. You may have to use entirely GTK+ in your webpage, but this seems to be the only way to make a webpage containing GTK+ elements.

webbrowser dll file

I was wondering where on my computer I can find the dll file for the web browser control. The reason I need it is because I'd like to modify it for my own use, as I have found that being IE based, the webBrowser control doesn't give me everything I need, and I need to add various functions. Where can I find the dll for it?
Thanks.
System.Windows.Forms.WebBrowser is located in System.Windows.Forms.dll but this class is only the wrapper over IE engine, installed in the system. So you can't modify it as you need.
If you want to add your code, i advice to look on others engines, such as WebKit
the webBrowser control doesn't give me everything I need, and I need to add various functions
Webkit
should have everything you need. Since you're programming in C#, use a wrapper such as http://sourceforge.net/projects/webkitdotnet/ to add it to your form.

How can I create/skin a C# UI?

Ive been working on a C# project for a while now and I fell it needs change its look.
I have found a UI kit that I really like, which can be seen below:
http://medialoot.com/item/transparent-ui-kit/
Does anyone know how to do this?
Thanks
EDIT: Im using WinForms
EDIT2: Maybe I should convert over to WPF? Is this doable?
You can subclass most common controls and draw their appearance yourself. However, unless for novelty applications I doubt your users will thank you for doing so.
Your example is a library of controls. For you to have an appearance such as that you'll have to create or acquire a similar library of controls and replace all your controls in your project to get that appearance.
If you want to update colors (background, foreground, etc.) and such you can make a class that recurses through controls and sets the settings using reflection and a switch statement to process each control. Then just run this on each form before you show it. One word of caution about this, some controls don't respect your changes and get overridden with themes from the OS (datetimerpicker being the biggest culprit). You'll also need to consider whether your users will appreciate the extra work put in for color/appearance changes.
If you don't have very good design skill and have a good know how about creating such templates, its better to buy them.
And C# is just a language. You're looking to create templates and skins for either for ASP.NET website/application or for windows forms.
Have a look at DevExpress Skins
If you can afford it.

Programatically interact with the IE browser to fill in forms and navigate etc

I'd like to use C# to interact with the IE browser.
I have a feeling that shdocvw.dll will be involved, but there are so many classes in there that I don't know where to start, and maybe it's not even necessary to use it.
The goal here is to interact with a website, visiting it's pages and "warming it up," not unlike as described here by Kenneth Scott. The thing is, javascript is getting executed as you interact with a website, so it would be nice just to be able to login / submit forms exactly as you would on the website itself.
Plus it would be nice to be able to create a program that records my actions in IE, and then be able to slightly automate and slightly modify them.
Additionally, it would be nice if it could do all this in the background, without having to display the webpage at all.
I'm not looking for third party solutions, I want to do this myself (with your advice of course.)
Thanks.
You said you're not looking for a third party solution, however, we have used WatiN in work with great success for automated UI testing.
It's open source, so if you want to see how they do it, you can.
Things like selenium and watin are very mature frameworks for doing exactly what you ask. Unless the point is to learn for yourself how to do this I would use one of them.
Watin is also a great way to learn how to do this in c# as it is an open source c# project.

What is the best WebBrowser control that allows one proxy per instance?

I am making a multi-threaded [workers] application. Each thread should have it's own Non-GUI WebBrowser that Navigates to a web page and writes data to fields and click a button. I also need each WebBrowser to have it's own proxy. I tried the classic Windows.Forms.WebBrowser but I got stuck at the proxy part as it depends on IE global settings which won't work in my case. Any recommendations are welcome.
note: I tried doing it through HttpWebRequest/Response but it will never work as the data to be passed to the page contains a field called [ab_test_data] which gets its value from javascript code that calculate the value according to AB testing which I don't even fully understand. So a WebBrowser would be my best solution, unless someone can tell me how to convert that Javascript code that calculates ab_test_data to C# code. The algorithm used by the page I am trying to access is really sophisticated.
note2: ab_test_data value depends on Window.Event and Timestamp which can't be simulated on a httpWebRequest/Response.
note3: I tried Gecko, But it won't let me do anything to the webPage unless GeckoWebBrowser is drawn on the form (which I don't want).
Any solutions are welcome.
edit: If you know any WebBrowser that works like I want in any different language (Maybe Java) I would like to know.
Thanks in advance.
CefSharp: .Net binding for the Chromium Embedded Framework
use http://webkitdotnet.sourceforge.net/
As a question that may help, I wonder why browsers don't allow a proxy per (say) window/tab? I think a lot of it is because of lack of usefulness with respect to development time.
It may also be because the browsers [presumably] have centralized engines for things like web requests and caches, etc... Perhaps, allowing a proxy per window and/or tab would fundamentally alter the design of the modern browser and or have negative performance impacts. I don't really know. To illustrate the point further, consider things like Incognito mode and Private Browsing. In these cases, the browsers have, at least, conceptually made separate caches per windows...but I still bet an Incognito window and a standard window (in Chrome) use the same underlying web request engine.
Right now there are so many people who want a JavaScript and DOM parser and interpreter. Projects like the HtmlAgility Pack and Jint are helping, but there doesn't seem to be a unified and standard solution; at least not one with the simplicity of a web browser.
[rant below]...
Unfortunately, projects like Jint and HtmlAgility are worrisome. For one, they're not IE, Chrome, Safari or FireFox. You don't exactly know what you're getting yourself into. For instance, you know that in Chrome page xyz.com loads and renders perfectly. You can fire up FireFox and see that maybe something is not quite the same and so on with the other browsers. But, with these libraries you don't really know what if not everything is working right (there's no visual display to do a quick check). Plus, who knows what pace they're being developed at. Do they keep up with HTML5? Do they lag behind the major browsers? What about performance? Even more so, browsers already have things like caching and performance enhancements, which I doubt you'll get with individual libraries.
The best browser control would of course be something like:
IWebBrowser browser = new IE();
IWebBrowser browser = new Chrome();
IWebBrowser browser = new Safari();
IWebBrowser browser = new FireFox();
I think that is a dream, unfortunately. For one, what if you ever wanted to load plug-ins with these? What about user profiles, user logins, and so on? I think most of us just want the muscle of the browsers without these extras.
I really do hope that you find a good Chrome solution. I don't know what, if any, luck you'll have in the FireFox realm - maybe you can keep us updated? These solutions are evolving so quickly - I had never even heard of CefSharp or WebKit.NET before today and I looked for the same thing (Chrome and/or FireFox .NET browsers) several months ago for my own use. It would be great if a lot of people got together, made a standard interface and then each company built their embedded browser against the spec. Here's to wishing.

Categories

Resources