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. COM
  4. Exception Handling Error

Exception Handling Error

Scheduled Pinned Locked Moved COM
helpquestionc++databasecom
4 Posts 2 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.
  • S Offline
    S Offline
    soup
    wrote on last edited by
    #1

    Hi, I have a very simple program that is going to use ADO as the interface to a database. I imported ADO in a wrapper class using the following line: #import "C:\Program Files\Common Files\System\Ado\msado15.dll" no_namespace rename("EOF", "adoEOF") My code to connect to the selected database looks like: try { m_objConn.CreateInstance(__uuidof(Connection)); m_objConn->Open(strConn, strUser, strPass, m_lngConnOptions); } catch(_com_error &errConn) { m_strLastError = (char *) errConn.Description(); m_objConn = NULL; } If everything is fine so ADO can connect all is good. :) However, when the connection fails (for any reason, such as bad connection string, DSN doesn't exist etc), I get the following error: First-chance exception in MyDBApp.exe (MSVCRTD.DLL): 0xE06D7363: Microsoft C++ Exception. I traced through the code, into the import .tli/.tlh file and the exception occurs in the call (or around the call) to _com_issue_errorex(...). Has anyone ever encountered a problem with COM error handling like this before? If so, what is the solution, because so far the problem seems to lie with COM/ADO, not my application. Under debug, the code continues, under release, it invalid page faults. Please help! Thanks in advance, Simon

    T 1 Reply Last reply
    0
    • S soup

      Hi, I have a very simple program that is going to use ADO as the interface to a database. I imported ADO in a wrapper class using the following line: #import "C:\Program Files\Common Files\System\Ado\msado15.dll" no_namespace rename("EOF", "adoEOF") My code to connect to the selected database looks like: try { m_objConn.CreateInstance(__uuidof(Connection)); m_objConn->Open(strConn, strUser, strPass, m_lngConnOptions); } catch(_com_error &errConn) { m_strLastError = (char *) errConn.Description(); m_objConn = NULL; } If everything is fine so ADO can connect all is good. :) However, when the connection fails (for any reason, such as bad connection string, DSN doesn't exist etc), I get the following error: First-chance exception in MyDBApp.exe (MSVCRTD.DLL): 0xE06D7363: Microsoft C++ Exception. I traced through the code, into the import .tli/.tlh file and the exception occurs in the call (or around the call) to _com_issue_errorex(...). Has anyone ever encountered a problem with COM error handling like this before? If so, what is the solution, because so far the problem seems to lie with COM/ADO, not my application. Under debug, the code continues, under release, it invalid page faults. Please help! Thanks in advance, Simon

      T Offline
      T Offline
      Tim Smith
      wrote on last edited by
      #2

      This is perfectly normal. Anytime an exception is raised, you will get some type of "First-chance exception" message. The rest of the message is just saying that it is a C++ exception (the _com_issue_errorex). You catch statement will catch the error and you can process it and handle it. Don't worry about first-chance exceptions that you are handling properly. Tim Smith I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?

      S 1 Reply Last reply
      0
      • T Tim Smith

        This is perfectly normal. Anytime an exception is raised, you will get some type of "First-chance exception" message. The rest of the message is just saying that it is a C++ exception (the _com_issue_errorex). You catch statement will catch the error and you can process it and handle it. Don't worry about first-chance exceptions that you are handling properly. Tim Smith I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?

        S Offline
        S Offline
        soup
        wrote on last edited by
        #3

        Tim, Thanks for the response. I was obviously getting silly and became side-tracked by the (handled) unhandled exception! :-D However, my crash under release remains. Not sure if you can help, but I tracked it down to a worker thread using a window pointer to send a message (using SendMessage). After peeking in the documentation (I have little threading knowledge), it says windows handles are unreliable. If this is the case, how can my thread tell the child frame it is running in that it has completed? Thanks for any help, Simon

        T 1 Reply Last reply
        0
        • S soup

          Tim, Thanks for the response. I was obviously getting silly and became side-tracked by the (handled) unhandled exception! :-D However, my crash under release remains. Not sure if you can help, but I tracked it down to a worker thread using a window pointer to send a message (using SendMessage). After peeking in the documentation (I have little threading knowledge), it says windows handles are unreliable. If this is the case, how can my thread tell the child frame it is running in that it has completed? Thanks for any help, Simon

          T Offline
          T Offline
          Tim Smith
          wrote on last edited by
          #4

          You should be able to use the REAL window handle (as in HWND). Windows is smart enough, to thunk the SendMessage over to the proper thread. It is just that you can't use CWnd points. One thing you can do is build your release build with debug information. This will allow you to run the optimized code in the debugger. Looking at local variables will be very hit or miss (and sometimes will just flat out tell you the wrong thing), but it might help to track down the problem. Tim Smith I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?

          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