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. Catching Exceptions in MFC

Catching Exceptions in MFC

Scheduled Pinned Locked Moved C / C++ / MFC
databasec++debugginghelpquestion
3 Posts 3 Posters 0 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.
  • N Offline
    N Offline
    nobaq
    wrote on last edited by
    #1

    Hi, Is there a way to catch Exceptions in my SDI MFC application in a very low level? What I mean: I work with an SQL database and it may be that I have an error in the SQL syntax etc. In this case a specific exceptions is thrown. I do not want to catch it somewhere in my code for View/Document but rather somewhere in the application object and then just display an error message and terminating my application the right way (including calling of all destructors). When I do not catch them, I get a "Runtime error" in the debug version. I would like to have this similar behaviour. Regards, Niki

    L H 2 Replies Last reply
    0
    • N nobaq

      Hi, Is there a way to catch Exceptions in my SDI MFC application in a very low level? What I mean: I work with an SQL database and it may be that I have an error in the SQL syntax etc. In this case a specific exceptions is thrown. I do not want to catch it somewhere in my code for View/Document but rather somewhere in the application object and then just display an error message and terminating my application the right way (including calling of all destructors). When I do not catch them, I get a "Runtime error" in the debug version. I would like to have this similar behaviour. Regards, Niki

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      You can add a global exception handler using the SetUnhandledExceptionFilter Function[^] and catch all SQL related errors and return EXCEPTION_EXECUTE_HANDLER for all other exceptions or maybe handle them as well. Best Wishes, -David Delaune

      1 Reply Last reply
      0
      • N nobaq

        Hi, Is there a way to catch Exceptions in my SDI MFC application in a very low level? What I mean: I work with an SQL database and it may be that I have an error in the SQL syntax etc. In this case a specific exceptions is thrown. I do not want to catch it somewhere in my code for View/Document but rather somewhere in the application object and then just display an error message and terminating my application the right way (including calling of all destructors). When I do not catch them, I get a "Runtime error" in the debug version. I would like to have this similar behaviour. Regards, Niki

        H Offline
        H Offline
        Hamid Taebi
        wrote on last edited by
        #3

        See XCrashReport : Exception Handling and Crash Reporting - Part 4[^] if its helpful for you.

        Of one Essence is the human race thus has Creation put the base One Limb impacted is sufficient For all Others to feel the Mace (Saadi )

        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