SP2 breaks AxWebBrowser

From: Andy (Andy_at_discussions.microsoft.com)
Date: 10/20/04


Date: Wed, 20 Oct 2004 16:25:03 -0700

My problem is similar to the thread entited, "SP2 kills my AxWebBrowser"
except that I haven't been able to get the fixes to work for me.

I've written an application that uses an embedded WebBrowser control for
most of it's UI. (At the time it seemed like a good idea, but in retrospect
I think it was more work than it was worth.) In it, I first navigate to
about:blank, wait for the browser to be ready, and then write my html to the
control. The code looks something like this:

object o = null;
axWebBrowser1.Navigate("about:blank", ref o, ref o, ref o, ref o);

// Wait for the control the be initialized and ready.
while(axWebBrowser1.ReadyState != SHDocVw.tagREADYSTATE.READYSTATE_COMPLETE)
Application.DoEvents();

// Update the HTML
IHTMLDocument2 doc;
object boxDoc = axWebBrowser1.Document;
doc = (IHTMLDocument2)boxDoc;

doc.body.innerHTML = "";
doc.write(str);

// Use this class for event handling.
// Need to create a function as follows to handle these messages:
// [DispId(0)]
// public void DefaultMethod()
//
// Get the event as follows:
// IHTMLEventObj e = document.parentWindow.@event;
doc.onclick = this;

The problem is, that "doc" is now null when I try to retrieve it. So I
assume I need to somehow first display the IE security bar to the user, wait
for them to click on it and then after they have given me permission,
proceed as normal. I've tried simply re-adding the control and shdocvw.dll
but with no luck.

The other thread suggests implementing some interfaces (which I didn't have
to do before, so I'm not sure that I need to now.) Perhaps I just need to
implement one of these interfaces so the IE security bar will display?

So I guess the question is in summary:
1) Why is axWebBrowser1.Document null?
2) What is the easiest way to make IE trust my application?

Thanks in advance,
Andy



Relevant Pages

  • SP2 breaks AxWebBrowser
    ... I've written an application that uses an embedded WebBrowser control for ... axWebBrowser1.Navigate("about:blank", ref o, ref o, ref o, ref o); ... The other thread suggests implementing some interfaces (which I didn't have ... implement one of these interfaces so the IE security bar will display? ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Excellent Navigation Method!
    ... Thanks so much Albert, I'll try it out. ... > Actually, as a developer, and general rule you do want to avoid global vars. ... you got a form ref... ... > sub-form control event to set a reference. ...
    (microsoft.public.access.forms)
  • Re: web browser ctrl - retrieve address for display in textbox?
    ... HTMLDocument doc = this.axWebBrowser1.Document; ... this.axWebBrowser1.Navigate2(ref loc, ref null_obj, ref null_obj, ref ... Uri url = web1.Document.Url; ... control and then look at the Url property on the HtmlDocument instance ...
    (microsoft.public.dotnet.languages.csharp)
  • problem with vs.net
    ... I created a control and added it into Toolbox. ... After sometime it started giving me errors so I removed the ref and deleted ... ref long time) but the icon looks like old vb controls rather my given icon. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Visual C++ wont autcomplete?
    ... is not the control position on a dialog a "property"? ... But in VS6, the properties were organized by IMPORTANCE ... and two decades of UI design and books on good UI ... and over again that modality in user interfaces was completely wrong, ...
    (microsoft.public.vc.mfc)