Instantiate Shell.Explorer.2 at runtime for a web page

J

jmi0

I want to create a custom user control to be used in a web page (by
object tag) as an assembly. The user control needs to have a web
browser control in it. Having tried with the managed
System.Windows.Forms.WebBrowser or AxSHDocVw.AxWebBrowser, none of them

worked from IE invocation unfortunately. While
System.Windows.Forms.WebBrowser showed the page in Visual Studio 5000
Designer, AxSHDocVw.AxWebBrowser caught an exception at Navigate
function call.


Anyway, now I'm trying to use Shell.Explorer.2 in my custom user
control at runtime. The way I instantiate it is such:
Type loT = Type.GetTypeFromProgID("Shell.Explorer.2");
this.IE = Activator.CreateInstance(loT);
Then, this.IE can access all the properties of the ActiveX control,
like MenuBar, ToolBar etc.
However, it failed at, again, calling Navigate method. Debugger won't
step over the call.


If I replace Shell.Explorer.2 with InternetExplorer.Application, it
worked fine. Except that's not what I wanted because it launches IE in
a separate window.


Interestingly enough, if I embed Shell.Explorer.2 with its classid
directly into my web html page. It showed well, except the html object
id lost the reference to the control after exiting the onload function
in my javascript.


I must have missed something fundamantal in this attempt. Really hope
someone can direct me a little.


Thanks,
Jason
 
J

jmi0

Well, I think all these might be due to the argument TargetFrameName
passed to the method Navigate() of the Web Browser control. When a new
window (either a name string in javascript or boolean true for new
window in a C# assembly) is specified for the argument, the object
instance lives. Otherwise, it dies.

I now need to figure out the right value for it. I used the html frame
name for it in a direct embedding. The control won't display. I don't
know what to pass to it in my custom C# user control which contained
the browser control.

Jason
 

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

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,281
Latest member
Pedroaciny

Latest Threads

Top