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 programmaticall y.
Public Sub ShowURL(ByVal sURL As String)
If Not Me.Visible Then Me.Show
Try
browser.Navigat e(sURL)
Catch ex As Exception
System.Diagnost ics.Debug.Write Line(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.Show URL(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.ct lMyControl. The exception
was "File or assembly name AxInterop.SHDoc Vw, 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.
[b] 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!Ra iseException() + 0x55
rpcrt4.dll!RpcR aiseException() + 0x1d
NETAPI32.DLL!Ne tpSetFileSecuri ty() + 0x3db
NTLANMAN.DLL!NP GetResourceInfo rmation() + 0x41d
NTLANMAN.DLL!NP GetResourceInfo rmation() + 0x127
mpr.dll!WNetGet ResourceInforma tionW() + 0xed
mpr.dll!WNetGet ConnectionW() + 0x1b9
mpr.dll!WNetGet ConnectionW() + 0x15f
SHELL32.DLL!Con trol_FillCache_ RunDLLW() + 0x14c0
SHELL32.DLL!SHG etIconOverlayIn dexA() + 0x15369
SHELL32.DLL!SHG etIconOverlayIn dexA() + 0x3531
SHELL32.DLL!She llExec_RunDLLW( ) + 0x3a86
SHELL32.DLL!She llExec_RunDLLW( ) + 0x3d4a
SHELL32.DLL!SHG etIconOverlayIn dexA() + 0x3531
SHELL32.DLL!SHG etFileInfoW() + 0x2f0
SHELL32.DLL!Dll CanUnloadNow() + 0x36
SHDOCVW.DLL!Dll CanUnloadNow() + 0x7f
SHDOCVW.DLL!Dll CanUnloadNow() + 0x309
SHDOCVW.DLL!Dll GetClassObject( ) + 0x4141
SHDOCVW.DLL!Dll GetClassObject( ) + 0x8571
SHDOCVW.DLL!Dll GetClassObject( ) + 0x8166
SHDOCVW.DLL!Hli nkFrameNavigate NHL() + 0x496e
SHDOCVW.DLL!Dll RegisterWindowC lasses() + 0xdf9d
axinterop.shdoc vw.dll!AxSHDocV w.AxWebBrowser. Navigate(string
uRL = "file://c:/foo.txt", System.Object flags =
{System.Reflect ion.Missing}, System.Object targetFrameName
= {System.Reflect ion.Missing}, System.Object postData =
{System.Reflect ion.Missing}, System.Object headers =
{System.Reflect ion.Missing}) + 0x5d bytes