in

dotNetFreak

Ramblings & Controls from a .NET Addicted Freak!

Kevin Gearing's Blog

September 2004 - Posts

  • System.Runtime.InteropServices.SEHException

    Argh! Just when my application was starting to look really good I come across the dreaded "System.Runtime.InteropServices.SEHException".

    For those of you who don't know, this tends to happen if you make use of Application.EnableVisualStyles() to give your program the XP look 'n' feel, or in my case if you're using Skybounds excellent VisualStyles component (http://www.skybound.ca/developer/visualstyles/) and start opening Dialog windows.

    Whilst removing Application.EnableVisualStyles() or using a Manifest file will fix the problem, I'd lose the themed tabs and other controls that I've come to love...

    Fortunately this is only happening with one particular window, so as a quick and simple hack I simply added a Timer control (has to be System.Timers.Timer as System.Windows.Forms.Timer doesn't solve the problem) to the parent window, set Timer.Interval to 100 and Timer.Enabled to False. Then moved my code from the 'problem' eventhandler to the Timer.Elapsed event and added Timer.Stop on the first line. Then back in the original eventhandler I added Timer.Start. The result? Problem fixed.

    Hopefully this will be resolved in Whidbey.

Copyright ©2004-2007 Kevin Gearing. All Rights Reserved.
Powered by Community Server (Non-Commercial Edition), by Telligent Systems