none
Embedded Internet Explorer RRS feed

  • Question

  • Hi you guys.

    I am working on a project that needs to display an image and place objects on top of it. Furthermore, the entire picture with objects needs to be able to rotate on screen.
    I have been working with HTML for a couple of years, so I figured that I would simply add an IE object and use this.

    The IE object was added, but most JavaScripts failed horribly. After some debugging, I found that the IE object identified itself as IE7. IE7 does not handle JavaScript like we do now. I found some Registry changes to change this after a few hour Google search. I have now tried IE7, IE10 and IE11 using this Registry edit (on a Windows 10 computer) with the same result.

    Is there a way for me to embed a web browser directly by pointing to the .exe file or an OCX object? And how would I be able to communicate with this?

    Any ideas would be highly appreciated.

    Thanx in advance, Geir Moen

    Monday, July 2, 2018 9:54 AM

Answers

  • The WebBrowser control in Winforms is horribly out of date and based upon a (no longer supported) version of IE.

    Actually the WebBrowser control is a wrapper around the same thing that IE uses; the WebBrowser control is IE. I wish I had bookmarked some pages that make things real clear but see Building ActiveX Controls for Internet Explorer; it says "the WebBrowser Control (SHDOCVW) and MSHTML".

    Oooh! There it is! See the link to About the Browser (Internet Explorer). That makes it very clear with diagrams and such. 




    Sam Hobbs
    SimpleSamples.Info

    • Marked as answer by Geir Moen Friday, July 6, 2018 12:28 AM
    Monday, July 2, 2018 9:24 PM

All replies

  • Maybe you did not set the appropriate registry value. According to https://weblog.west-wind.com/posts/2011/May/21/Web-Browser-Control-Specifying-the-IE-Version, there are separate values for 32- and 64-bit cases. In addition, when the program is started from Visual Studio for debugging, you have to specify the “.vshost.exe” name instead of “.exe”.


    Monday, July 2, 2018 10:30 AM
  • The WebBrowser control in Winforms is horribly out of date and based upon a (no longer supported) version of IE. Changing registry entries doesn't change the IE engine being used.

    The Edge team posted a blog article a while back about the plan to bring Edge to Winforms/WPF apps. I recommend that you read it. It'll be what you want to use if you need to host a web browser for a modern site.

    However I don't see in your question where you actually need a web browser or HTML. You mention that you need to display an image and place objects on top of it. None of that screams HTML. Is there a particular requirement for using HTML and a web browser to meet your needs?


    Michael Taylor http://www.michaeltaylorp3.net

    Monday, July 2, 2018 1:41 PM
    Moderator
  • I have been working with HTML for a couple of years, so I figured that I would simply add an IE object and use this.

    You are saying you are using HTML because it seems to be the easiest solution but you are having difficulty doing it. Most developers will suggest not using HTML for that and will resist helping with it, for one thing it is not what we would do so we are not familiar with the details. Most of us know from experience that there are likely unknown challenges in the future.

    First decide whether you want to use Windows Forms, WPF or UWP. Then post in the corresponding forum. If you were to use HTML then you need to learn the stuff I have in my Introduction to Web Site Scraping but as I say I suggest not using HTML for this.



    Sam Hobbs
    SimpleSamples.Info

    Monday, July 2, 2018 8:47 PM
  • The WebBrowser control in Winforms is horribly out of date and based upon a (no longer supported) version of IE.

    Actually the WebBrowser control is a wrapper around the same thing that IE uses; the WebBrowser control is IE. I wish I had bookmarked some pages that make things real clear but see Building ActiveX Controls for Internet Explorer; it says "the WebBrowser Control (SHDOCVW) and MSHTML".

    Oooh! There it is! See the link to About the Browser (Internet Explorer). That makes it very clear with diagrams and such. 




    Sam Hobbs
    SimpleSamples.Info

    • Marked as answer by Geir Moen Friday, July 6, 2018 12:28 AM
    Monday, July 2, 2018 9:24 PM
  • This was the mental picture I had in my mind as well.
    And it turned out to be a simple "InternetExplorer incompatibility" problem, as it usually is with InternetExplorer.

    The script was tested on MS Edge, Google Chrome and FireFox. I completely forgot that Windows10 uses Edge and not IE10 or IE11.
    The JavaScripts worked fine once I had it working in IE10. ... and Registry-hacked the computer to run IE10.

    Thanks to all of you for helping me out here.

    Friday, July 6, 2018 12:28 AM
  • Not really.

    But I need to rotate it and I also need to show only a small portion of a very big image.
    I have been playing with some tutorials on how to rotate images native in Visual Studio, but the movements are not smooth, and it hogs a lot of resources on the CPU.

    I have done this with relative ease in Google Chrome and figured that this should not be a problem as long as I had a WebBrowser element available to me. Boy - was I wrong.

    But never fear - it has been resolved. It turned out that IE10 simply refused to work like every other Web browser on the planet. Nothing new, in other words ... and that my manual tests were done in MS Edge. not IE10.

    Friday, July 6, 2018 12:37 AM
  • I did make the Registry-hacks needed, but I wrongly assumed that IE10 would behave like every other "modern" browser. Edge seems to be a lot better in this regard. And that was my downfall as well. My scripts was tested in Edge. Never tested in IE10.
    Once I rewrote the scripts for IE10, the whole thing fell into place.

    But the link you supplied was much better than what I found on the subject.
    I will make sure to bookmark this for future reference.

    Thanx a lot.

    Friday, July 6, 2018 12:42 AM
  • I was trying to use HTML because I have some experience with it and the task at hand should not be a problem. I had forgotten all my hours I spent in anger over InternetExplorer. And frankly, I thought that the problem was an outdated browser. Not IE incompatibility.

    I'm pretty much done with this now, but please let me know how I should have attacked the problem and not using the old web browser -approach ?

    Friday, July 6, 2018 12:48 AM
  • Displaying an image and rotating it and manipulating it is really easy to use with Winforms or even WPF. With Winforms you can use a simple picturebox to render an image. If you want to rotate and/or add to it then a simple control with transform does all that just as easily. There isn't really a need for the overhead of loading HTML in my opinion.

    WPF has a huge learning curve but rendering and transforming images is incredibly simple as this is what it is designed for.


    Michael Taylor http://www.michaeltaylorp3.net

    Friday, July 6, 2018 1:33 AM
    Moderator
  • I agree with Michael except I would say that what you are doing is graphics but not graphics UI and the way we do graphics is quite similar, nearly the same, regardless of the UI. But I don't do much graphics so other experts might say otherwise.

    HTML version 5 has a "canvas" that is for graphics.

    Well you learned from the experience. You now have a better understanding of the advantages and disadvantages of browser technology. I think the consideration is HTML and what it is designed to do, independent of the browsers.



    Sam Hobbs
    SimpleSamples.Info

    Friday, July 6, 2018 4:35 AM