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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Exception Error.

Exception Error.

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++debugging
11 Posts 2 Posters 1 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.
  • F Offline
    F Offline
    FISH786
    wrote on last edited by
    #1

    Can Someone help I am not sure whats wrong. I am getting the following debug message: First-chance exception at 0x5d0c373e in Capture Data.exe: 0xC0000005: Access violation writing location 0x0043454c. However on exit I get: The program '[1284] Capture Data.exe: Native' has exited with code 0 (0x0). Here is the code I have used:

    BOOL CCaptureDataApp::InitInstance()
    {
    InitCommonControls();
    CWinApp::InitInstance();
    CCaptureDataSheet sheet("My Very Own Property Sheet App",NULL,0);
    sheet.m_psh.dwFlags |= PSH_NOAPPLYNOW;//hide apply button
    m_pMainWnd=&sheet;
    INT_PTR nResponse=sheet.DoModal();
    return FALSE;

    In the Capture Data Sheet

    IMPLEMENT_DYNAMIC(CCaptureDataSheet, CPropertySheet)
    CCaptureDataSheet::CCaptureDataSheet(UINT nIDCaption, CWnd* pParentWnd, UINT iSelectPage)
    :CPropertySheet(nIDCaption, pParentWnd, iSelectPage)
    {
    AddPage(&m_Page01);
    AddPage(&m_Page02);
    }

    CCaptureDataSheet::CCaptureDataSheet(LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectPage)
    :CPropertySheet(pszCaption, pParentWnd, iSelectPage)
    {
    AddPage(&m_Page01);
    AddPage(&m_Page02);
    }

    CCaptureDataSheet::~CCaptureDataSheet()
    {
    }
    BOOL CCaptureDataSheet::OnInitDialog()
    {
    BOOL bResult = CPropertySheet::OnInitDialog();
    }

    C 1 Reply Last reply
    0
    • F FISH786

      Can Someone help I am not sure whats wrong. I am getting the following debug message: First-chance exception at 0x5d0c373e in Capture Data.exe: 0xC0000005: Access violation writing location 0x0043454c. However on exit I get: The program '[1284] Capture Data.exe: Native' has exited with code 0 (0x0). Here is the code I have used:

      BOOL CCaptureDataApp::InitInstance()
      {
      InitCommonControls();
      CWinApp::InitInstance();
      CCaptureDataSheet sheet("My Very Own Property Sheet App",NULL,0);
      sheet.m_psh.dwFlags |= PSH_NOAPPLYNOW;//hide apply button
      m_pMainWnd=&sheet;
      INT_PTR nResponse=sheet.DoModal();
      return FALSE;

      In the Capture Data Sheet

      IMPLEMENT_DYNAMIC(CCaptureDataSheet, CPropertySheet)
      CCaptureDataSheet::CCaptureDataSheet(UINT nIDCaption, CWnd* pParentWnd, UINT iSelectPage)
      :CPropertySheet(nIDCaption, pParentWnd, iSelectPage)
      {
      AddPage(&m_Page01);
      AddPage(&m_Page02);
      }

      CCaptureDataSheet::CCaptureDataSheet(LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectPage)
      :CPropertySheet(pszCaption, pParentWnd, iSelectPage)
      {
      AddPage(&m_Page01);
      AddPage(&m_Page02);
      }

      CCaptureDataSheet::~CCaptureDataSheet()
      {
      }
      BOOL CCaptureDataSheet::OnInitDialog()
      {
      BOOL bResult = CPropertySheet::OnInitDialog();
      }

      C Offline
      C Offline
      Code o mat
      wrote on last edited by
      #2

      I don't know why you get that exception but try turning on "Break into debugger on exceptions" in Visual Studio, it might show you where exactly the exception gets thrown. (In VS2003 it's under Debug->Exceptions in the menu)

      > The problem with computers is that they do what you tell them to do and not what you want them to do. < > Life: great graphics, but the gameplay sux. <

      F 2 Replies Last reply
      0
      • C Code o mat

        I don't know why you get that exception but try turning on "Break into debugger on exceptions" in Visual Studio, it might show you where exactly the exception gets thrown. (In VS2003 it's under Debug->Exceptions in the menu)

        > The problem with computers is that they do what you tell them to do and not what you want them to do. < > Life: great graphics, but the gameplay sux. <

        F Offline
        F Offline
        FISH786
        wrote on last edited by
        #3

        This is where i am stuck in the debgugger. Not sure whats happening?

        BOOL AFXAPI AfxDeactivateActCtx(DWORD dwFlags, ULONG_PTR ulCookie)
        {
        BOOL rc = pfnDeactivateActCtx != 0 ? pfnDeactivateActCtx(dwFlags, ulCookie) : FALSE;
        return rc;
        }

        Why would it exit with a 0 if I haven't changed anything else in the code? Would it not give me a memory leak or something?

        1 Reply Last reply
        0
        • C Code o mat

          I don't know why you get that exception but try turning on "Break into debugger on exceptions" in Visual Studio, it might show you where exactly the exception gets thrown. (In VS2003 it's under Debug->Exceptions in the menu)

          > The problem with computers is that they do what you tell them to do and not what you want them to do. < > Life: great graphics, but the gameplay sux. <

          F Offline
          F Offline
          FISH786
          wrote on last edited by
          #4

          [http://msdn.microsoft.com/en-us/library/0bw65cxb(VS.80).aspx](<a href=)[^]"> This article states to ignore the return value from the CPropertySheet Class, unless I mis-understood it. Does that mean I ignore the exception as well?

          C 1 Reply Last reply
          0
          • F FISH786

            [http://msdn.microsoft.com/en-us/library/0bw65cxb(VS.80).aspx](<a href=)[^]"> This article states to ignore the return value from the CPropertySheet Class, unless I mis-understood it. Does that mean I ignore the exception as well?

            C Offline
            C Offline
            Code o mat
            wrote on last edited by
            #5

            Don't know but i doubt it.

            > The problem with computers is that they do what you tell them to do and not what you want them to do. < > Life: great graphics, but the gameplay sux. <

            F 1 Reply Last reply
            0
            • C Code o mat

              Don't know but i doubt it.

              > The problem with computers is that they do what you tell them to do and not what you want them to do. < > Life: great graphics, but the gameplay sux. <

              F Offline
              F Offline
              FISH786
              wrote on last edited by
              #6

              I am sorry I am not trying to be a pain. This is frustratung me... Here is what I did...Any suggetions... On a different machine i went down in versions..from 2008-2005-and finally to VStudio 6. I used the same steps in all ..I got the same exception error except in Vstudio 6..Where I got no exception error...Imported the same project into my Visual Studio 2008 and it works fine...No First-chance error. I am not sure what to do?...Well for now I can work with this imported project...but is this really a solution?...I have come to the end of the rope on this one...If I did something wrong, would VStudio 6 not complain as well? Do you think you can advice me as what to do? I don't like to give up, at the sametime I don't want to be hitting my head if it is a bug in VStudio 2008? I can't see me to be the only one trying or using the property sheet based application? Thanks, I will really appreciate some sort of feed back, I am new at this and it's frustrating me..Please advice.

              C 1 Reply Last reply
              0
              • F FISH786

                I am sorry I am not trying to be a pain. This is frustratung me... Here is what I did...Any suggetions... On a different machine i went down in versions..from 2008-2005-and finally to VStudio 6. I used the same steps in all ..I got the same exception error except in Vstudio 6..Where I got no exception error...Imported the same project into my Visual Studio 2008 and it works fine...No First-chance error. I am not sure what to do?...Well for now I can work with this imported project...but is this really a solution?...I have come to the end of the rope on this one...If I did something wrong, would VStudio 6 not complain as well? Do you think you can advice me as what to do? I don't like to give up, at the sametime I don't want to be hitting my head if it is a bug in VStudio 2008? I can't see me to be the only one trying or using the property sheet based application? Thanks, I will really appreciate some sort of feed back, I am new at this and it's frustrating me..Please advice.

                C Offline
                C Offline
                Code o mat
                wrote on last edited by
                #7

                Is it possible that maybe all your project needed was a complete rebuild?

                > The problem with computers is that they do what you tell them to do and not what you want them to do. < > Life: great graphics, but the gameplay sux. <

                F 1 Reply Last reply
                0
                • C Code o mat

                  Is it possible that maybe all your project needed was a complete rebuild?

                  > The problem with computers is that they do what you tell them to do and not what you want them to do. < > Life: great graphics, but the gameplay sux. <

                  F Offline
                  F Offline
                  FISH786
                  wrote on last edited by
                  #8

                  I did 3 different projects and with all I did a rebuild.. thinking of the same thing?

                  C 1 Reply Last reply
                  0
                  • F FISH786

                    I did 3 different projects and with all I did a rebuild.. thinking of the same thing?

                    C Offline
                    C Offline
                    Code o mat
                    wrote on last edited by
                    #9

                    Yes, i am just clueless how importing the very same project from 6.0 would solve your problem... So you say the exception is thrown from AfxDeactivateActCtx? I supose that the pfnDeactivateActCtx pointer is pointing at something it shouldn't be. Can you maybe try to track down where this gets a value assigned? Maybe whatever it is pointing at gets destroyed somewhere and then the pointer is not NULL-ed out...

                    > The problem with computers is that they do what you tell them to do and not what you want them to do. < > Life: great graphics, but the gameplay sux. <

                    F 1 Reply Last reply
                    0
                    • C Code o mat

                      Yes, i am just clueless how importing the very same project from 6.0 would solve your problem... So you say the exception is thrown from AfxDeactivateActCtx? I supose that the pfnDeactivateActCtx pointer is pointing at something it shouldn't be. Can you maybe try to track down where this gets a value assigned? Maybe whatever it is pointing at gets destroyed somewhere and then the pointer is not NULL-ed out...

                      > The problem with computers is that they do what you tell them to do and not what you want them to do. < > Life: great graphics, but the gameplay sux. <

                      F Offline
                      F Offline
                      FISH786
                      wrote on last edited by
                      #10

                      I am getting it in disassembly.

                      C 1 Reply Last reply
                      0
                      • F FISH786

                        I am getting it in disassembly.

                        C Offline
                        C Offline
                        Code o mat
                        wrote on last edited by
                        #11

                        Check your callstack untill you see something familiar, otherwise i am out of ideas and without actually seeing this happen i doubt i can do anything to help, sorry :( . Maybe someone else has a good idea...

                        > The problem with computers is that they do what you tell them to do and not what you want them to do. < > Life: great graphics, but the gameplay sux. <

                        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