SHDocVw.InternetExplorer return value

  • Thread starter Thread starter Tom
  • Start date Start date
T

Tom

Hi,

I wrote the following code in a c# winform.

InternetExplorer ie = new InternetExplorer();
ie.Navigate(url, ref o, ref o, ref o, ref o);

The url can be passed to the IE.

However, how can I know that the url can be successfully
open? e.g. asp.net website can be open when I see the web
pages. If there is 404 or 500 server error, the web page
cannot be displayed.

How can I get the return value of True or False ? (T/F or
1/0)

I cannot search the namespace for SHDocVw.

Thanks for help
 
Tom said:
Hi,

I wrote the following code in a c# winform.

InternetExplorer ie = new InternetExplorer();
ie.Navigate(url, ref o, ref o, ref o, ref o);

The url can be passed to the IE.

However, how can I know that the url can be successfully
open? e.g. asp.net website can be open when I see the web
pages. If there is 404 or 500 server error, the web page
cannot be displayed.

How can I get the return value of True or False ? (T/F or
1/0)

I cannot search the namespace for SHDocVw.

Thanks for help

You need to watch for one of the events such as NavigateError() ..
 
Sorry, if the url in m_WebBrowser.Navigate(url, ref o, ref
o, ref o, ref o) will return a string.

I declare

string a;

a = m_WebBrowser.Navigate(url, ref o, ref o, ref o, ref o);

There is compile error to say that void cannot be assigned
to string.

Since I pass the variables to the url and it will return a
string back, how can I get the returned string?

Thanks for your kind help
 
Tom said:
Sorry, if the url in m_WebBrowser.Navigate(url, ref o, ref
o, ref o, ref o) will return a string.

I declare

string a;

a = m_WebBrowser.Navigate(url, ref o, ref o, ref o, ref o);

There is compile error to say that void cannot be assigned
to string.

Since I pass the variables to the url and it will return a
string back, how can I get the returned string?

Thanks for your kind help


-----Original Message-----

successfully

web

page

or


You need to watch for one of the events such as

NavigateError() ..

It looks like you are importing the COM object for InternetExplorer from
ShDocVw dll. If that is the case, Navigate does not return anything
except maybe HRESULT. Since that will be wrapped by the RCW (Runtime
Callable wrapper) generation to throw an exception, the signature for
that method is *void*. So, you cannot get a string back from that call.

You need to wrap it with try/catch to find any errors at runtime.
As for finding out if it navigated or not, you need to handle
NavigateError and other events. Lookup MSDN for *InternetExplorer*
object. The help will be for the COM object and that will hold true for
your calling as well.

HTH
 
Back
Top