Click here to Skip to main content
16,005,037 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Amout of memory used by a process Pin
Joaquín M López Muñoz21-May-02 9:21
Joaquín M López Muñoz21-May-02 9:21 
GeneralRe: Amout of memory used by a process Pin
Rickard Andersson2021-May-02 10:50
Rickard Andersson2021-May-02 10:50 
GeneralRe: Amout of memory used by a process Pin
Joaquín M López Muñoz21-May-02 11:20
Joaquín M López Muñoz21-May-02 11:20 
GeneralRe: Amout of memory used by a process Pin
Prem Kumar21-May-02 10:53
Prem Kumar21-May-02 10:53 
QuestionATL Web Server return values question? Pin
Ollie21-May-02 7:09
Ollie21-May-02 7:09 
AnswerRe: ATL Web Server return values question? Pin
Philip Patrick21-May-02 7:21
professionalPhilip Patrick21-May-02 7:21 
GeneralRe: ATL Web Server return values question? Pin
Ollie21-May-02 7:20
Ollie21-May-02 7:20 
GeneralDebug Assertion Fail Pin
tongc21-May-02 7:12
tongc21-May-02 7:12 
hi all

My program compiles ok but in run-time whenever i tried to access a function from the CListBox MFC class that is placed in a CDialog from View class, it gives me the above error. Does any one know why??

The sameple code is placed below

Dlg dialog;
	
	
	CString temp[4];
	for (int i = 0 ; i < 4; i++)
	{
		temp[i] = pDoc->A.getTeam(i);
	}

	dialog.SetTeam(temp);



	if(dialog.DoModal()==IDOK)
	{
//		pDoc->A.setResult(dialog.GetCurSelTeam1(),dialog.GetCurSelScore1(),
//							dialog.GetCurSelTeam2(), dialog.GetCurSelScore2());

	
		curSelTeam1 = dialog.GetCurSelTeam1();  //this one here bring up error, 
	}


and here is my Dlg class
// Dlg.cpp : implementation file
//


Dlg::Dlg(CWnd* pParent /*=NULL*/)
	: CDialog(Dlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(Dlg)
	//}}AFX_DATA_INIT


	for(int i = 0; i< 4; i++)
	{
		team[i] = "";
	}
}

const int Dlg::GetCurSelTeam1()
{

	return  m_team1.GetCurSel();
}

void Dlg::SetTeam(CString t[4])
{
	for(int i = 0; i< 4; i++)
	{
		team[i] = t[i];
	}
}


void Dlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(Dlg)
	DDX_Control(pDX, IDC_LIST4, m_team2);
	DDX_Control(pDX, IDC_LIST3, m_score2);
	DDX_Control(pDX, IDC_LIST2, m_score1);
	DDX_Control(pDX, IDC_LIST1, m_team1);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(Dlg, CDialog)
	//{{AFX_MSG_MAP(Dlg)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// Dlg message handlers

BOOL Dlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
		
	for(int i = 0 ; i< 4; i++)
		m_team1.AddString(team[i]);


	for(int j = 0 ; j< 4; j++)
		m_team2.AddString(team[j]);
	
	// TODO: Add extra initialization here
	for(int k = 48 ; k < 58; k++)
	{
		m_score1.AddString(CString(k));
	}

	for(int m = 48 ; m <58; m++)
	{
		m_score2.AddString(CString(m));
	}

	m_team1.SetCurSel(0);
	m_team2.SetCurSel(0);
	m_score1.SetCurSel(0);
	m_score2.SetCurSel(0);
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}


Thanks for reading this everyone and hopefully you can enlighten me! Smile | :)

Source code of the program can be downloaed for further investigation at http://z3r0n3.hypermart.net/ass3_q1.exe
GeneralRe: Debug Assertion Fail Pin
Tim Smith21-May-02 7:17
Tim Smith21-May-02 7:17 
GeneralRe: Debug Assertion Fail Pin
Philip Patrick21-May-02 7:17
professionalPhilip Patrick21-May-02 7:17 
GeneralRe: Debug Assertion Fail Pin
tongc21-May-02 8:16
tongc21-May-02 8:16 
GeneralDamned CALLBACK! Pin
S van Leent21-May-02 7:04
S van Leent21-May-02 7:04 
GeneralRe: Damned CALLBACK! Pin
Le centriste21-May-02 7:09
Le centriste21-May-02 7:09 
GeneralRe: Damned CALLBACK! Pin
RobJones21-May-02 7:11
RobJones21-May-02 7:11 
GeneralRe: Damned CALLBACK! Pin
Paul M Watt21-May-02 8:35
mentorPaul M Watt21-May-02 8:35 
GeneralRe: Damned CALLBACK! Pin
S van Leent21-May-02 9:04
S van Leent21-May-02 9:04 
GeneralRe: Damned CALLBACK! Pin
Joaquín M López Muñoz21-May-02 8:42
Joaquín M López Muñoz21-May-02 8:42 
GeneralRe: Damned CALLBACK! Pin
S van Leent21-May-02 9:08
S van Leent21-May-02 9:08 
GeneralRe: Damned CALLBACK! Pin
Joaquín M López Muñoz21-May-02 9:18
Joaquín M López Muñoz21-May-02 9:18 
GeneralAnother thread question :) Pin
RobJones21-May-02 6:33
RobJones21-May-02 6:33 
GeneralRe: Another thread question :) Pin
Philip Patrick21-May-02 7:11
professionalPhilip Patrick21-May-02 7:11 
GeneralRe: Another thread question :) Pin
RobJones21-May-02 7:22
RobJones21-May-02 7:22 
GeneralRe: Another thread question :) Pin
Philip Patrick21-May-02 7:28
professionalPhilip Patrick21-May-02 7:28 
GeneralRe: Another thread question :) Pin
RobJones21-May-02 7:43
RobJones21-May-02 7:43 
GeneralRe: Another thread question :) Pin
Philip Patrick21-May-02 8:24
professionalPhilip Patrick21-May-02 8:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.