Question : Unhandled exception when adding edit box

Hi expert

Once again, I got a problem

My program working properly before I add an edit box on my dialog. I have 3 edit boxes and its running successfully. But when I try to add another edit box, I got this error when running the program

"Unhandled exception at 0x57a9dd8b (mfc90d.dll) in ReTIME.exe: 0xC0000005: Access violation reading location 0x68f8260f."

Then the Visual Studio 2008 workspace show a code with yellow arrow.
Here, part of the code (where yellow arrow was pointing) in altsimpstr.h

      ATL_NOINLINE void Fork( _In_ int nLength )
      {
            CStringData* pOldData = GetData();
            int nOldLength = pOldData->nDataLength;
            CStringData* pNewData = pOldData->pStringMgr->Clone()->Allocate( nLength, sizeof( XCHAR ) );
            if( pNewData == NULL )
            {
                  ThrowMemoryException();
            }
            int nCharsToCopy = ((nOldLength < nLength) ? nOldLength : nLength)+1;  // Copy '\0'
            CopyChars( PXSTR( pNewData->data() ), nCharsToCopy,
                  PCXSTR( pOldData->data() ), nCharsToCopy );
            pNewData->nDataLength = nOldLength;
            pOldData->Release();
            Attach( pNewData );
      }


How to fix it

Thank and Regard

Answer : Unhandled exception when adding edit box

I think you are trying to use a window before it is created - so bad pointers are in use.
I keep asking for you to post your code.  Without it we are very limted in being able to help you.


eg.
Do you assign a value to m_mylseDimensi anywhere in your code?  If yes then please post the code in the function that is doing that.   (I guess it is one of your OnBtn... handlers based on your previous question).
Random Solutions  
 
programming4us programming4us