Internet Explorer control

G

Graham

Hi everyone

I'm having a couple of problems with the Internet Explorer
browser control. I'm using VS.NET 2003 on Win2k SP4 with IE6.

First, let me briefly describe how it's used in my project.

1. I have a DLL containing a form which hosts the IE
Browser control, using the AxInterop stuff that is
generated when you add a reference to the COM ShDocVw
library. This form is basically just a web browser
which I can control programmatically.

Public Sub ShowURL(ByVal sURL As String)
If Not Me.Visible Then Me.Show

Try
browser.Navigate(sURL)
Catch ex As Exception
System.Diagnostics.Debug.WriteLine(ex.Message)
End Try
End Sub

2. I have a DLL containing a UserControl. Under certain
conditions, this control will make use of the web
browser form described above:

Private Sub ShowDetails( ... )
Dim sDetailsURL As String = ...
...
Dim dlgBrowser As frmBrowser = New frmBrowser
dlgBrowser.ShowURL(sDetailsURL)
End Sub

3. I have a DLL containing a form, which uses the
UserControl described above.

4. Finally, there is an EXE which will instantiate the form
and display it.

Okay... on to the problems.

[A] If I open the form (#3 in the above list) in the Forms
Designer, it complains that it can't instantiate the
control (#2):

An exception occurred while trying to create an
instance of MyControlLib.ctlMyControl. The exception
was "File or assembly name AxInterop.SHDocVw, or one
of its dependencies, was not found.".

The control works fine at run time though!

I have tried putting a ShDocVw reference in the project
(#3) where the form resides, but this doesn't help.

When the browser control's Navigate function is called
by ShowURL, I get this error:

First-chance exception at 0x7c57e592 (KERNEL32.DLL) in
MyApp.exe: 0x000006BA: The RPC server is unavailable.

Strangely, even though there's a try-catch around the
Navigate call, execution breaks here, and I see the
above error message in a dialog box (the type you
might see when your native C/C++ code segfaults).

I'll paste the stack dump at the end of this message.

Here's the weird part. If I comment out the Navigate
call in ShowURL(), but then allow the user to enter a
URL in a textbox, click on a Go button, and call
Navigate from there... everything works fine.

Any advice would be greatly appreciated. Thanks.

-- graham


The following is the contents of the Call Stack window when
the "RPC server is unavailable" exception occurs.

KERNEL32.DLL!RaiseException() + 0x55
rpcrt4.dll!RpcRaiseException() + 0x1d
NETAPI32.DLL!NetpSetFileSecurity() + 0x3db
NTLANMAN.DLL!NPGetResourceInformation() + 0x41d
NTLANMAN.DLL!NPGetResourceInformation() + 0x127
mpr.dll!WNetGetResourceInformationW() + 0xed
mpr.dll!WNetGetConnectionW() + 0x1b9
mpr.dll!WNetGetConnectionW() + 0x15f
SHELL32.DLL!Control_FillCache_RunDLLW() + 0x14c0
SHELL32.DLL!SHGetIconOverlayIndexA() + 0x15369
SHELL32.DLL!SHGetIconOverlayIndexA() + 0x3531
SHELL32.DLL!ShellExec_RunDLLW() + 0x3a86
SHELL32.DLL!ShellExec_RunDLLW() + 0x3d4a
SHELL32.DLL!SHGetIconOverlayIndexA() + 0x3531
SHELL32.DLL!SHGetFileInfoW() + 0x2f0
SHELL32.DLL!DllCanUnloadNow() + 0x36
SHDOCVW.DLL!DllCanUnloadNow() + 0x7f
SHDOCVW.DLL!DllCanUnloadNow() + 0x309
SHDOCVW.DLL!DllGetClassObject() + 0x4141
SHDOCVW.DLL!DllGetClassObject() + 0x8571
SHDOCVW.DLL!DllGetClassObject() + 0x8166
SHDOCVW.DLL!HlinkFrameNavigateNHL() + 0x496e
SHDOCVW.DLL!DllRegisterWindowClasses() + 0xdf9d
axinterop.shdocvw.dll!AxSHDocVw.AxWebBrowser.Navigate(string
uRL = "file://c:/foo.txt", System.Object flags =
{System.Reflection.Missing}, System.Object targetFrameName
= {System.Reflection.Missing}, System.Object postData =
{System.Reflection.Missing}, System.Object headers =
{System.Reflection.Missing}) + 0x5d bytes
 
G

Graham

Just an update:

1. I'm now seeing the "crash" any time I call Navigate.
It doesn't matter whether I wait for the user to click
a Go button... it dies in exactly the same way.

2. I've eliminated a few layers, just for debugging, so I
am down to two projects:

- a DLL project containing the web browser form
- an EXE project which attempts to instantiate that
form and call its ShowURL function

BTW, I do not believe that the two problems that I
described are closely related... their only relation, IMHO,
is that they both have to do with the IE browser control.

-- graham
 
G

Graham

An exception occurred while trying to create an
instance of MyControlLib.ctlMyControl. The exception
was "File or assembly name AxInterop.SHDocVw, or one
of its dependencies, was not found.".

Solution: Don't try to instantiate the browser form inside
the usercontrol's New() function.

Instead, I now instantiate the browser form the first time
it is needed. The forms designer now seems to be happy.

-- graham
 

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