views:

563

answers:

2

Hi!

Developing an Internet Explorer command button, that will open a specific web page once clicked. A snippet of code (IEApp is a reference to an instance of IE.WebBrowser.):

IEApp.Navigate(sURL, ref one, ref two, ref three, ref four);

The above line throws the following COMException:

Exception Source: Interop.SHDocVw Exception Type: System.Runtime.InteropServices.COMException Exception Message: The requested resource is in use. (Exception from HRESULT: 0x800700AA) Exception Target Site: Navigate

This wasn't a problem on IE6 or IE7. Any ideas on what's going wrong? I'm using AddInExpress for creating the command button.

Cheers! Christian

A: 

That's ERROR_BUSY usually happens when IE is doing something else, e.g. displaying a window.alert message box.
Try suppress script errors and Implement IDocHostShowUI and return S_OK without blocking the message pump

Sheng Jiang 蒋晟
The current URL is about:blank, also when checking the property on the IE.WebBrowser so I don't think it's actually doing anything.
ChrispedDK
what is the return value of IWebBrowser2::get_ReadyState
Sheng Jiang 蒋晟
try stop the current navigation (if you indeed want to stop when the page is not completed loaded) or add the navigation to a request queue and use a timer to wait IWebBrowser2::get_Busy returns false.
Sheng Jiang 蒋晟
Adding an IEApp.Stop(); before the Nagivate, doesn't change the outcome, I'm afraid.
ChrispedDK
what is the value of IWebBrowser2::get_Busy?
Sheng Jiang 蒋晟
It says 'true', even right after I do a .Stop();This is the code:string sURL;System.Object one = null;System.Object two = null;System.Object three = null;System.Object four = null;sURL = "http://www.google.dk";IEApp.Stop();MessageBox.Show(IEApp.Busy.ToString());IEApp.Navigate(sURL, ref one, ref two, ref three, ref four);
ChrispedDK
where is this code in? if it is button click then disable the button when the busy property is true.
Sheng Jiang 蒋晟
A: 

Hi was curious to know if there was a solution to this problem? I am facing a similar issue.

pks