ShowDialog() causes SEHException: Why???

Posted on 2005-04-07
Last Modified: 2008-01-09
Hi all,

Here's the sequence of events for this problem I'm having:
1) I have no SEHExceptions
2) I add a class to my project containing __event declarations
3) I add code in another class to subscribe to the events in the new class
4) An old dialog box, one that has been closing without any hiccups for many months, suddenly throws an SEHException whenever it closes.
5) If I undo all __event declarations and comment out the subscribing and handling code the problem goes away.

I've been googling this problem for a few hours and find that most occurrences of this problem resulted from adding the EnableVisualStyles call in code. However, in my case, I am not doing that. I had never heard of EnableVisualStyles before I began googling for this problem.

Does anyone know how to identify the source of this particular SEHException? I can't even catch the exception with try{} catch(System::Runtime::InteropServices::SEHException * e) {}. I'm stumped and my boss is not happy because this problem is holding up my scheduled release.

Any help is much appreciated.

Question by:javanic
    LVL 1

    Author Comment

    Well, this problem has gone away for me. I changed several settings in my C/C++ compile property pages (in MS 2003 .NET IDE) and the problem went away. I wish I could say exactly which of the changes solved the problem, but I can't. I tried to undo each of the changes one by one to find the culprit, but I could not duplicate the problem with those changes.

    I had noticed that several of my settings were not the default ones for a .exe product. I simply selected the <inherit from project type> option and recompiled.

    If there's a lesson here it is: don't mess with the compile options unless you know exactly what you are doing. Just take the project type defaults when possible.

    To the area admins, I suggest this be PAQ'd and closed with points refunded.
    LVL 1

    Accepted Solution

    PAQed with points refunded (250)

    Community Support Moderator

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
    In Easy String Encryption Using CryptoAPI in C++ ( I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now