I've mentioned in the past that I like the SessionSaver extension for Firefox and would like to implement similar functionality for RSS Bandit. I finished up this feature last night but I kept getting weird behavior. The expected behavior is that when RSS Bandit is launched it remembers the application state from the last time it was closed such as whether it was minimized to the system tray, open browser tabs, what nodes in the feed subscription tree were expanded and what news item(s) were selected. 

The weird behavior was that every once in a while when the application restarted, I'd get an InvalidActiveXStateException which was thrown from the IWebBrowser2.Navigate method when restoring the open browser tabs from the previous time the application ran. Further investigation narrowed the issue down to only showing up when the application had been minimized to the system tray when it was closed and thus being immediately minimized to the system tray when the application was restarted. 

I managed to read a comment on some forum that indicated that the problem is that IWebBrowser2.Navigate method doesn't work if the WebBrowser control isn't visible. This means that this feature won't work as smoothly as I'd like when the application is restarted after being closed from the system tray but it does get rid of the ugly exception.

I hope this blog post explains why the feature will seem wonky in this situation for our users and may prove useful to developers who come across this weird error in the future.


Thursday, February 8, 2007 6:43:32 PM (GMT Standard Time, UTC+00:00)
Dare, I'm not sure if this is the same thing, but I've had similar problems with IWebBrowser2 that were cured by navigating to about:blank before navigating to a "real" HTML document.
Thursday, February 8, 2007 8:20:10 PM (GMT Standard Time, UTC+00:00)
There is no "system tray". See http://blogs.msdn.com/oldnewthing/archive/2003/09/10/54831.aspx

And yes, I am aware that this is fighting windmills but everyone needs an obscure hobby :)
Don Quixote
Thursday, February 8, 2007 11:45:01 PM (GMT Standard Time, UTC+00:00)

Can you not open the app window offscreen in a normal state (say, negative x/y co-ordinates so you don't get caught out with uber large resolution monitors), do the navigations, then minimise to the system tray?

Friday, February 9, 2007 12:17:34 AM (GMT Standard Time, UTC+00:00)

negative x/y co-ordinates won't work with some multi-monitor setups :)

Another possible workaround could be to delay the state initialization to the first time the window is restored.
Björn Graf
Friday, February 9, 2007 8:34:49 PM (GMT Standard Time, UTC+00:00)
That's a great idea. I'll look into making that change when I get home today.
Comments are closed.