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. 0xC0000005:Acces violation

0xC0000005:Acces violation

Scheduled Pinned Locked Moved C / C++ / MFC
debugginghelpquestion
5 Posts 5 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.
  • G Offline
    G Offline
    Geert Craessaerts
    wrote on last edited by
    #1

    Can anyone explain me what I have to do with this error? 0xC0000005:Acces Violation The debugger stops at: //perform specific initializations if (!pThread->InitInstance()) { if(pThread->m_pMainWnd !=NULL) { TRACE0("Warning: Destroying non-NULL m_pMainWnd\n"); pThread->m_pMainWnd->DestroyWindow(); } nReturnCode=pThread->ExitInstance(); goto InitFailure; } nReturnCode = pThread ->Run(); The debugger stops at the line; pThread->m_pMainWnd->DestroyWindow(); Thanx, kind regards, Geert

    X R 2 Replies Last reply
    0
    • G Geert Craessaerts

      Can anyone explain me what I have to do with this error? 0xC0000005:Acces Violation The debugger stops at: //perform specific initializations if (!pThread->InitInstance()) { if(pThread->m_pMainWnd !=NULL) { TRACE0("Warning: Destroying non-NULL m_pMainWnd\n"); pThread->m_pMainWnd->DestroyWindow(); } nReturnCode=pThread->ExitInstance(); goto InitFailure; } nReturnCode = pThread ->Run(); The debugger stops at the line; pThread->m_pMainWnd->DestroyWindow(); Thanx, kind regards, Geert

      X Offline
      X Offline
      xxhimanshu
      wrote on last edited by
      #2

      put a breakpoint before the line and see what it is returning..and what u were expecting..so you will know why it is happening.. I guess you are doing it wrong way..so it doesn't know anything such as window to be destroyed..try m_pmainWnd->destroywindow(); i hope this will work..;) cheers.. Himanshu

      1 Reply Last reply
      0
      • G Geert Craessaerts

        Can anyone explain me what I have to do with this error? 0xC0000005:Acces Violation The debugger stops at: //perform specific initializations if (!pThread->InitInstance()) { if(pThread->m_pMainWnd !=NULL) { TRACE0("Warning: Destroying non-NULL m_pMainWnd\n"); pThread->m_pMainWnd->DestroyWindow(); } nReturnCode=pThread->ExitInstance(); goto InitFailure; } nReturnCode = pThread ->Run(); The debugger stops at the line; pThread->m_pMainWnd->DestroyWindow(); Thanx, kind regards, Geert

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

        Just a quick stab in the dark, but the fact that your UI Thread failed to initialised : pThread->InitInstance() // returns false .. would indicate that the handle to the thread's main window, pThread->m_pMainWnd, may not have been initialised. This would explain the memory violation when attempting to do pThread->m_pMainWnd->DestroyWindow();. The fact that m_pMainWnd is not NULL is not an indication that it is a valid handle. .. ... and my golly god, did I see a goto statement at the end of your code? :omg:

        T 1 Reply Last reply
        0
        • R RChin

          Just a quick stab in the dark, but the fact that your UI Thread failed to initialised : pThread->InitInstance() // returns false .. would indicate that the handle to the thread's main window, pThread->m_pMainWnd, may not have been initialised. This would explain the memory violation when attempting to do pThread->m_pMainWnd->DestroyWindow();. The fact that m_pMainWnd is not NULL is not an indication that it is a valid handle. .. ... and my golly god, did I see a goto statement at the end of your code? :omg:

          T Offline
          T Offline
          Ted Ferenc
          wrote on last edited by
          #4

          Or you have not waited until it HAS initialised


          If I have seen further it is by standing on the shoulders of Giants. - Isaac Newton 1676

          J 1 Reply Last reply
          0
          • T Ted Ferenc

            Or you have not waited until it HAS initialised


            If I have seen further it is by standing on the shoulders of Giants. - Isaac Newton 1676

            J Offline
            J Offline
            joshfl
            wrote on last edited by
            #5

            damn, thats a bold 'goto' statement. to hell with efficiency, long live 'goto' lol! ! todo.... :: insert inpirational text here ::

            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