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, 08 February 2007 18:43:32 (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, 08 February 2007 20:20:10 (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, 08 February 2007 23:45:01 (GMT Standard Time, UTC+00:00)
Dare,

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?

M
Friday, 09 February 2007 00:17:34 (GMT Standard Time, UTC+00:00)
Mark,

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, 09 February 2007 20:34:49 (GMT Standard Time, UTC+00:00)
Björn,
That's a great idea. I'll look into making that change when I get home today.
Comments are closed.