Error in memory location at "0x00000000"
Posted: Mon Jul 12, 2010 7:46 pm
I am using Activex version of TeeChart to plot a few charts with the data taken from a text file. I am using "fopen" and "fgets" functions to read the data and i am storing them in a safe array (similar method as given in "add data arrays" example for Visual C++). I am getting the following error (4 out of 5 times) when i close my application/dialog box.
The instruction at "0x00000000" referenced memory at "0x00000000". The memory could not be "read". Click on OK to terminate the program.
Following are some of the features in my program:
* i have to plot 7 different charts (one in each dialog box) with the data taken from 6 different text files. All the 7 charts have to be displayed in parallel and hence i am using the "modeless" method
* i am calling the main dialog box from "InitInstance" function using "DoModal()" and then i am creating objects for other dialog boxes inside the main dialog box. The code looks something like this:-
IDD_NBIQ_DIALOG1 is the main dialog box and i am creating object for the next dialog box (nbiq_dialog2) inside the OnInitDialog() of "nbiq_dialog1"
* i am using "COleSafeArray" data type and "AddArray" function to plot the line charts. I then use the "clear" function of "COleSafeArray" class at the end of each file to clear the contents
Can someone throw some light on this issue? I have been facing this problem over past 1 week and i am not able to trace the problem.
PS: i am a newbie to C++ and MFCs. I have learned to do all this only by looking at example projects and by going through this forum.
Thanks,
Hari
The instruction at "0x00000000" referenced memory at "0x00000000". The memory could not be "read". Click on OK to terminate the program.
Following are some of the features in my program:
* i have to plot 7 different charts (one in each dialog box) with the data taken from 6 different text files. All the 7 charts have to be displayed in parallel and hence i am using the "modeless" method
* i am calling the main dialog box from "InitInstance" function using "DoModal()" and then i am creating objects for other dialog boxes inside the main dialog box. The code looks something like this:-
Code: Select all
BOOL CTest2App::InitInstance()
{
AfxEnableControlContainer();
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
nbiq_dialog1 nbiq_dlg1;
m_pMainWnd = &nbiq_dlg1;
int nResponse = nbiq_dlg1.DoModal();
return FALSE;
}
Code: Select all
BOOL nbiq_dialog1::OnInitDialog()
{
CDialog::OnInitDialog();
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
PlotNBIQSpectrum();
nbiq_dialog2 *nbiq_dlg2;
nbiq_dlg2 = new nbiq_dialog2;
nbiq_dlg2->Create(IDD_NBIQ_DIALOG1,this);
nbiq_dlg2->ShowWindow(1);
return TRUE; // return TRUE unless you set the focus to a control
}
* i am using "COleSafeArray" data type and "AddArray" function to plot the line charts. I then use the "clear" function of "COleSafeArray" class at the end of each file to clear the contents
Can someone throw some light on this issue? I have been facing this problem over past 1 week and i am not able to trace the problem.
PS: i am a newbie to C++ and MFCs. I have learned to do all this only by looking at example projects and by going through this forum.
Thanks,
Hari