SP2 breaks AxWebBrowser

A

Andy Heitke

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
 
A

Andy Heitke

Sorry about that, this is my first post. Thanks for the tip, I'll repost
there.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top