Solved

Access Violation from dialog based app in AFX_DATA_INIT

Posted on 1998-06-04
2
330 Views
Last Modified: 2013-11-19
This plain and simple (that was the original goal) dialog based application is suddently issuing an access violation when a CString is being initialized, in this code:

///////////////////////////////////////////////////////////
// CMyDlg dialog

CMyDlg::CMyDlg(CWnd* pParent /*=NULL*/)
      : CDialog(CMyDlg::IDD, pParent)
{
      //{{AFX_DATA_INIT(CDpKeyDlg)
      m_myText = _T("");
      //}}AFX_DATA_INIT
      // Note that LoadIcon does not require a subsequent DestroyIcon in Win32
      m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

It stops at CString::AllocBeforeWrite(int nLen) in Strcore.cpp. I also noticed that it does not call DoDataExchange(CDataExchange* pDX) or OnInitDialog() before it enters the above code and CString initialization.

The worst is that the application was working before this came up. No major change was made, except for adding edit boxes and the variables from ClassWizard itself.

Have you any ideas of what could be happening?

RJV
0
Comment
Question by:RJV
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 100 total points
ID: 1315988
It sounds like your program may have corrupted memory before instantiating the dialog and the symptom you see is the string class failing. I would look into making sure you're not corrupting memory. Some things to check are arrays and pointers access and usage.
0
 

Author Comment

by:RJV
ID: 1315989
thui,

Seeing as you did identify the problem, here are the points.

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
bobThere java chalenge 45 95
Replacement selected text 2 65
wordcount challenge 11 145
Can not remove SSL certificate on iPhone 6 - iOS10.2 12 1,277
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question