SEHException when closing a form

R

Ryan Gregg

I'm trying to enable Windows XP themes in my application. First I tried
adding a call to Application.EnableVisualStyles(), but that didn't appear to
actually do anything (aka I still wasn't getting styles). Yes, I have all
my buttons and what not using FlatStyle = FlatStyle.System.

I added a manifest file to the application directory, and this enabled the
visual styles I was looking for. However, now when I call Close() on any
form, I get an SEHException whos message is "External component has thrown
an exception". The exception occurs in
System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg).

The internal error code of the SEHException is -2147467259.

It appears to be related to the Application.EnableVisualStyles() call. If I
keep the manifest file but remove the call, then I get visual styles and no
exception. If I remove the manifest file but keep the call, I don't have
visual styles and I get the exception.

Any ideas?

Thanks.

Ryan Gregg
 
J

Jeff Gaines

I'm trying to enable Windows XP themes in my application. First I tried
adding a call to Application.EnableVisualStyles(), but that didn't appear to
actually do anything (aka I still wasn't getting styles). Yes, I have all
my buttons and what not using FlatStyle = FlatStyle.System.

I added a manifest file to the application directory, and this enabled the
visual styles I was looking for. However, now when I call Close() on any
form, I get an SEHException whos message is "External component has thrown
an exception". The exception occurs in
System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg).

The internal error code of the SEHException is -2147467259.

It appears to be related to the Application.EnableVisualStyles() call. If I
keep the manifest file but remove the call, then I get visual styles and no
exception. If I remove the manifest file but keep the call, I don't have
visual styles and I get the exception.

Any ideas?

Thanks.

Ryan Gregg

Ryan

I had a similar problem where my manifest file had an incorrect
exe name in it, actually caused the app to crash.

Do you have Application.DoEvents() after
Application.EnableVisualStyles() - it seems to help sometimes.

It seems to me the safest route still is to use a manifest file
though.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top