locked
Load Addon in WebBrowser Control with C# 2.0 RRS feed

  • Question

  • Hi all, I have a problem... I developed an application that needs to shows some SVG content, so I used the WebBrowser control to load the html page with the SVG. The problem is that if I navigate to that page from IE8 everything works fine, but using the WebBrowser control the page shows a red X like when an image is missing... after some investigation I found that the WebBrowser control doesn't load the SVG addon... Is there any way t do it with C#?

    I tried to add a areference to the NPSVG3.DLL and call the SetSite function, but I don't see it in any class exposed by the COM wrapper made by VS2010....

    So... how can I load the SVG addon and connect it to the WebBrowser control?

    Thanks in advance


    star
    Monday, September 27, 2010 9:11 AM

Answers

  • I found a solution thanks to the user EvilFactor!

    Here is the quote:

    I had the exact same problem for ages. I resolved it by disabling DEP for the process, as well as building for x86 rather than AnyCPU (as from what I understand, all x64 processes automatically have DEP active.) It appears the Adobe SVG plugin may be doing something that Vista and Windows 7 dislike. Note that this will only work if the DEP setting for your machine isn't set to AlwaysOn. Give this a try and see if it'll work for you:

    Go to Project Properties -> Compile -> Build Events

     

    Paste the following under post-build:

     

    call "$(DevEnvDir)..\tools\vsvars32.bat"

    editbin.exe /NXCOMPAT:NO "$(TargetPath)"


    star
    • Marked as answer by Star Italia Tuesday, September 28, 2010 11:06 AM
    Tuesday, September 28, 2010 11:05 AM

All replies

  • I made other experiments and I found the following:

    1) If I launch the page directly from the WebBrowser control embedded in my application it doesn't work...

    2) If I launch a page in the WebBrowser control with a window.open inside that open th svg it doesn't work

    3) If I launch a page in the WebBrowser control with a window.open inside that open th svg and a Internet Explorer window in the background it works!

     

    Any idea?


    star
    Monday, September 27, 2010 1:57 PM
  • I found a solution thanks to the user EvilFactor!

    Here is the quote:

    I had the exact same problem for ages. I resolved it by disabling DEP for the process, as well as building for x86 rather than AnyCPU (as from what I understand, all x64 processes automatically have DEP active.) It appears the Adobe SVG plugin may be doing something that Vista and Windows 7 dislike. Note that this will only work if the DEP setting for your machine isn't set to AlwaysOn. Give this a try and see if it'll work for you:

    Go to Project Properties -> Compile -> Build Events

     

    Paste the following under post-build:

     

    call "$(DevEnvDir)..\tools\vsvars32.bat"

    editbin.exe /NXCOMPAT:NO "$(TargetPath)"


    star
    • Marked as answer by Star Italia Tuesday, September 28, 2010 11:06 AM
    Tuesday, September 28, 2010 11:05 AM
  • You saved my day! Just configure the 'Platform target' as X86 on the project properties --> 'Build' tab, and everything works fine. I am amazed. Thank you for the post!
    Tuesday, April 5, 2011 7:13 PM
  • Thanks, You saved my day! Just build with 'Platform target' as X86 and everything works fine. VLC plug in loads in Webcontrol. Thank you for the post!
    Thursday, February 15, 2018 9:12 AM
  • Yes, but it looks like that the plugin set of Real Browser and WebBrowser Control are different.

    E.g., if I disable some plugin in IE it still works in WebBrowser control - anybody know why this happens and how to overcome it?

    Friday, February 28, 2020 9:01 AM