[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Access Violation from dialog based app in AFX_DATA_INIT

Posted on 1998-06-04
2
Medium Priority
?
340 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 300 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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 response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

650 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