WebBrowser.Navigate(…) throws COMException

2019-03-19 11:54发布

I'm developing an Internet Explorer command button that will open a specific web page once clicked. Here's 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

2条回答
贪生不怕死
2楼-- · 2019-03-19 12:12

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

查看更多
一纸荒年 Trace。
3楼-- · 2019-03-19 12:17

could this help: turning off UAC in Windows, if you are using a server kind version:

screen-shoots here: http://blog.vincentbrouillet.com/post/2011/02/10/watin%3A-The-requested-resource-is-in-use

I had this error, and it was quite random. I tried killing IE before running the tests. It kind of work, but not all the time.

查看更多
登录 后发表回答