Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

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

80 views
Skip to first unread message

jm...@att.net

unread,
Jan 12, 2006, 1:55:32 PM1/12/06
to
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

jm...@att.net

unread,
Jan 12, 2006, 6:52:45 PM1/12/06
to
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

0 new messages