Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Try - Catch VC6.0 VS VC2k5

Try - Catch VC6.0 VS VC2k5

Scheduled Pinned Locked Moved C / C++ / MFC
c++visual-studiodebugginghelpquestion
4 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    Wouter Dhondt
    wrote on last edited by
    #1

    Hi all. Due to an upgrade to Vista, I'm also upgrading my projects from VC++ 6.0 to VC++ 2K5. I have a strange problem, probably due to my limited knowledge of Vista / VC++ 2K5. Say I have this code compiled with VC++ 6.0: CDialog* pDialog = NULL; try { pDialog->Detach(); } catch(CException* e) { e->Delete(); } catch(...) { } No problem at all, the exception is handled. If I compile the same code with VC++ 2K5, I get a second chance exception. Both in debug en release versions. How come?

    ----------------------- "Hey, Eddie, can I pour you a beer?" "A little early, isn't it, Richy?" "For a beer?" "No, for stupid questions."

    M 1 Reply Last reply
    0
    • W Wouter Dhondt

      Hi all. Due to an upgrade to Vista, I'm also upgrading my projects from VC++ 6.0 to VC++ 2K5. I have a strange problem, probably due to my limited knowledge of Vista / VC++ 2K5. Say I have this code compiled with VC++ 6.0: CDialog* pDialog = NULL; try { pDialog->Detach(); } catch(CException* e) { e->Delete(); } catch(...) { } No problem at all, the exception is handled. If I compile the same code with VC++ 2K5, I get a second chance exception. Both in debug en release versions. How come?

      ----------------------- "Hey, Eddie, can I pour you a beer?" "A little early, isn't it, Richy?" "For a beer?" "No, for stupid questions."

      M Offline
      M Offline
      Mark Salsbery
      wrote on last edited by
      #2

      If you want to catch SEH exceptions like that (the C++ way) then you can enable it... Project/Properties/C++/Code Generation/enable C++ exceptions set to Yes with SEH exceptions (/EHa) Mark

      Mark Salsbery Microsoft MVP - Visual C++ "Great job team! Head back to base for debriefing and cocktails."

      W 1 Reply Last reply
      0
      • M Mark Salsbery

        If you want to catch SEH exceptions like that (the C++ way) then you can enable it... Project/Properties/C++/Code Generation/enable C++ exceptions set to Yes with SEH exceptions (/EHa) Mark

        Mark Salsbery Microsoft MVP - Visual C++ "Great job team! Head back to base for debriefing and cocktails."

        W Offline
        W Offline
        Wouter Dhondt
        wrote on last edited by
        #3

        Thanks. Works with that option. Actually, that's kind off silly. The code clearly states I want to catch exceptions. It makes no sense that you also have to enable an option to do what you've written in code. Hope there aren't many of these pitfalls. Any article on stuff like this so I can educate myself?

        ----------------------- New and improved: kwakkelflap.com "Hey, Eddie, can I pour you a beer?" "A little early, isn't it, Richy?" "For a beer?" "No, for stupid questions."

        M 1 Reply Last reply
        0
        • W Wouter Dhondt

          Thanks. Works with that option. Actually, that's kind off silly. The code clearly states I want to catch exceptions. It makes no sense that you also have to enable an option to do what you've written in code. Hope there aren't many of these pitfalls. Any article on stuff like this so I can educate myself?

          ----------------------- New and improved: kwakkelflap.com "Hey, Eddie, can I pour you a beer?" "A little early, isn't it, Richy?" "For a beer?" "No, for stupid questions."

          M Offline
          M Offline
          Mark Salsbery
          wrote on last edited by
          #4

          More info ... Exception Handling: Default Synchronous Exception Model[^] /EH (Exception Handling Model)[^]

          Mark Salsbery Microsoft MVP - Visual C++ "Great job team! Head back to base for debriefing and cocktails."

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups