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. access violations

access violations

Scheduled Pinned Locked Moved C / C++ / MFC
debugginghelp
5 Posts 4 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.
  • U Offline
    U Offline
    User 4315
    wrote on last edited by
    #1

    Hi, I am experiencing some strange problems. I am getting a whole bunch of access violations when I run my program. The program doesn't crash but in the debug window you can see about 200 access violation messages. I tracked this down to CMainFrame::OnCreate(). Infact, all of these access violations occur at the point where the CToolBar's CreateEx function get called. Here is what App Wizard created for my project for the CToolBar, if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || !m_wndToolBar.LoadToolBar(IDR_MAINFRAME)) { TRACE0("Failed to create toolbar\n"); return -1; // fail to create } The Toolbar get created, but with a whole bunch of access violations along the way. Another thing, this doesn't happen all the time. I would guess three out of five times I run the program, I get all of these access violations. Anyway, I hope someone know why this is happening. I would really appreciate the help. Just in case someone was interested, here is a look at what the violation message looks like First-chance exception in Plas.exe (GDI32.DLL): 0xC0000005: Access Violation. Thanks

    P S 2 Replies Last reply
    0
    • U User 4315

      Hi, I am experiencing some strange problems. I am getting a whole bunch of access violations when I run my program. The program doesn't crash but in the debug window you can see about 200 access violation messages. I tracked this down to CMainFrame::OnCreate(). Infact, all of these access violations occur at the point where the CToolBar's CreateEx function get called. Here is what App Wizard created for my project for the CToolBar, if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || !m_wndToolBar.LoadToolBar(IDR_MAINFRAME)) { TRACE0("Failed to create toolbar\n"); return -1; // fail to create } The Toolbar get created, but with a whole bunch of access violations along the way. Another thing, this doesn't happen all the time. I would guess three out of five times I run the program, I get all of these access violations. Anyway, I hope someone know why this is happening. I would really appreciate the help. Just in case someone was interested, here is a look at what the violation message looks like First-chance exception in Plas.exe (GDI32.DLL): 0xC0000005: Access Violation. Thanks

      P Offline
      P Offline
      Paolo Messina
      wrote on last edited by
      #2

      I don't know if this is the case, but I experieced some problems with AppWizard generated applications if they had a Toolbar but not a StatusBar, because even if I unselected the StatusBar in the Wizard page, some generated code still made use of it. Don't know why, but it's true. It seems, however, that your problem is a little different. You wrote of the toolbar creation, so I thought of my past troubles with it. Cheers, Paolo

      1 Reply Last reply
      0
      • U User 4315

        Hi, I am experiencing some strange problems. I am getting a whole bunch of access violations when I run my program. The program doesn't crash but in the debug window you can see about 200 access violation messages. I tracked this down to CMainFrame::OnCreate(). Infact, all of these access violations occur at the point where the CToolBar's CreateEx function get called. Here is what App Wizard created for my project for the CToolBar, if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || !m_wndToolBar.LoadToolBar(IDR_MAINFRAME)) { TRACE0("Failed to create toolbar\n"); return -1; // fail to create } The Toolbar get created, but with a whole bunch of access violations along the way. Another thing, this doesn't happen all the time. I would guess three out of five times I run the program, I get all of these access violations. Anyway, I hope someone know why this is happening. I would really appreciate the help. Just in case someone was interested, here is a look at what the violation message looks like First-chance exception in Plas.exe (GDI32.DLL): 0xC0000005: Access Violation. Thanks

        S Offline
        S Offline
        Sam Hobbs
        wrote on last edited by
        #3

        I am surprised that your program continues to run after an access violation. Perhaps VC 6 has something new for debugging that allows a program to continue execution in spite of an access violation; if so, I would not know about it since I still use VC 5. You might check to see if it is possible to get the debugger to stop when an access violation occurs. If you can do that then you can look at the stack and you might get a good indication of the problem. Are you sure you are working with a debug version of your program? You should, if you are getting errors like that.

        L 1 Reply Last reply
        0
        • S Sam Hobbs

          I am surprised that your program continues to run after an access violation. Perhaps VC 6 has something new for debugging that allows a program to continue execution in spite of an access violation; if so, I would not know about it since I still use VC 5. You might check to see if it is possible to get the debugger to stop when an access violation occurs. If you can do that then you can look at the stack and you might get a good indication of the problem. Are you sure you are working with a debug version of your program? You should, if you are getting errors like that.

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

          When you get your access violation don't cancel let it go into the debugger and look thru call stack window and start putting break points in in only the cpp's that you made not the one's from MS.

          S 1 Reply Last reply
          0
          • L Lost User

            When you get your access violation don't cancel let it go into the debugger and look thru call stack window and start putting break points in in only the cpp's that you made not the one's from MS.

            S Offline
            S Offline
            Sam Hobbs
            wrote on last edited by
            #5

            sspcmp: Unless your reply is relevant to my reply, you should reply to the question instead of my reply. I received notification of your reply by email but I already know how to use the debugger.

            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