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. Threads

Threads

Scheduled Pinned Locked Moved C / C++ / MFC
c++debugginghelpquestion
3 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.
  • R Offline
    R Offline
    Ruca
    wrote on last edited by
    #1

    Hi, I have a SDI application in which I create 2 extra threads. Using the debugger I get the following error intermittently: Unhandled Exception at 0x77e6d756 in Application.exe: Microsoft C++ exception: _com_error @ 0x02a3f44 Then the file comip.h is opened and the following bit of code generates the afore-mentioned error: HRESULT hr = CreateInstance( str, pOuter, dwClsContext ); The value of hr is 0x800401f0 CoInitialize has not been callled. If anyone has any clue what is going on here, feel free to let me know. I thank you for any suggestions. Regards Rui

    R 1 Reply Last reply
    0
    • R Ruca

      Hi, I have a SDI application in which I create 2 extra threads. Using the debugger I get the following error intermittently: Unhandled Exception at 0x77e6d756 in Application.exe: Microsoft C++ exception: _com_error @ 0x02a3f44 Then the file comip.h is opened and the following bit of code generates the afore-mentioned error: HRESULT hr = CreateInstance( str, pOuter, dwClsContext ); The value of hr is 0x800401f0 CoInitialize has not been callled. If anyone has any clue what is going on here, feel free to let me know. I thank you for any suggestions. Regards Rui

      R Offline
      R Offline
      Roger Stewart
      wrote on last edited by
      #2

      If you access any COM objects or make any calls to COM functions you must first call CoInitialize() at the beginning of each thread. Roger Stewart "I Owe, I Owe, it's off to work I go..."

      R 1 Reply Last reply
      0
      • R Roger Stewart

        If you access any COM objects or make any calls to COM functions you must first call CoInitialize() at the beginning of each thread. Roger Stewart "I Owe, I Owe, it's off to work I go..."

        R Offline
        R Offline
        Ruca
        wrote on last edited by
        #3

        Thanks, I forgot to add that I do have queries to a dB in my threads and yes I do have CoInitialize( NULL ); at the beginning of the function called by the thread. Unless the CoInit is at the wrong place. I would also like to add that I am running my code in debug and the error does not always occur. It appears randomly and this is what is puzzling me. Thanks regards Rui

        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