Adding page to a property sheet causes error

Hi,
First of all i'm using VC++ 6.0
My program has a property sheet called "CPropSheetPR" with 10 property pages in it. All added with AddPage(&m_RM) for example. My goal was to add another page with some new controls, therefore a propsheet with 11 proppages.
What I did is I created a new class "CPropPagePRReduct" then linked the new dialog "IDD_PROPPAGE_PR_REDUCT" to this class. I then modified the "CPropSheetPR"'s ".h" and ".cpp" to take into account the new property page (#including the classes and stuff).
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#if !defined(AFX_PROPSHEETPR_H__E81F39FF_470D_4C4A_8037_39391971395E__INCLUDED_)
#define AFX_PROPSHEETPR_H__E81F39FF_470D_4C4A_8037_39391971395E__INCLUDED_

#include "PropPagePRAgeRet.h"
#include "PropPagePREval.h"
#include "PropPagePRFrTx.h"
#include "PropPagePRGarDec.h"
#include "PropPagePRRM.h"
#include "PropPagePRVAug.h"
#include "PropPagePRAssVie.h"
#include "PropPagePRBanqueMaladie.h"
#include "PropPagePRPourc.h"
#include "PropPagePRPrimes.h"
#include "PropPagePRReduct.h"

#include "AssuranceCollDoc.h"

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// PropSheetPR.h : header file

/////////////////////////////////////////////////////////////////////////////
// CPropSheetPR

class CPropSheetPR : public CPropertySheet
{
	DECLARE_DYNAMIC(CPropSheetPR)

// Construction
public:
	CPropSheetPR(UINT nIDCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0);
	CPropSheetPR(LPCTSTR pszCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0);

// Attributes
public:

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CPropSheetPR)
	//}}AFX_VIRTUAL

// Implementation
public:
	virtual ~CPropSheetPR();
	void LoadFromDocument(CAssuranceCollDoc* pDoc);
	void SaveToDocument(CAssuranceCollDoc* pDoc);

	// Generated message map functions
protected:
	//{{AFX_MSG(CPropSheetPR)
	virtual BOOL OnInitDialog();
	afx_msg void OnApply();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()

private:
	CPropPagePREval				m_Eval;
	CPropPagePRAgeRet			m_AgeRet;
	CPropPagePRGarDec			m_GarDec;
	CPropPagePRFrTx				m_FrTx;
	CPropPagePRVAug				m_Vect;
	CPropPagePRRM				m_RM;
	CPropPagePRAssVie			m_AssVie;
	CPropPagePRBanqueMaladie	m_BM;
	CPropPagePRPourc			m_Primes;
	CPropPagePRPrimes			m_Pourc;
	CPropPagePRReduct			m_Reduct;

	CAssuranceCollDoc* m_pDoc;


};


And

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
// PropSheetPR.cpp : implementation file
//

#include "stdafx.h"
#include "AssuranceColl.h"
#include "PropSheetPR.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CPropSheetPR

IMPLEMENT_DYNAMIC(CPropSheetPR, CPropertySheet)

CPropSheetPR::CPropSheetPR(UINT nIDCaption, CWnd* pParentWnd, UINT iSelectPage)
	:CPropertySheet(nIDCaption, pParentWnd, iSelectPage)
{
	AddPage(&m_Eval);
	AddPage(&m_AgeRet);
	AddPage(&m_GarDec);
	AddPage(&m_FrTx);
	AddPage(&m_Vect);
	AddPage(&m_RM);
	AddPage(&m_AssVie);
	AddPage(&m_BM);
	AddPage(&m_Primes);
	AddPage(&m_Pourc);
	AddPage(&m_Reduct);
}

CPropSheetPR::CPropSheetPR(LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectPage)
	:CPropertySheet(pszCaption, pParentWnd, iSelectPage)
{
}

CPropSheetPR::~CPropSheetPR()
{
}


BEGIN_MESSAGE_MAP(CPropSheetPR, CPropertySheet)
	//{{AFX_MSG_MAP(CPropSheetPR)
	ON_BN_CLICKED(ID_APPLY_NOW, OnApply)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CPropSheetPR message handlers

BOOL CPropSheetPR::OnInitDialog() 
{
	BOOL bResult = CPropertySheet::OnInitDialog();
	
	CWnd *pWnd = GetDlgItem( ID_APPLY_NOW );
	pWnd->SetWindowText(_T("Appliquer"));

	pWnd = GetDlgItem( IDCANCEL );
	pWnd->SetWindowText(_T("Annuler"));

	return bResult;
}

void CPropSheetPR::LoadFromDocument(CAssuranceCollDoc* pDoc)
{
	m_AgeRet.LoadFromDoc(pDoc);
	m_AssVie.LoadFromDoc(pDoc);
	m_BM.LoadFromDoc(pDoc);
	m_Eval.LoadFromDoc(pDoc);
	m_FrTx.LoadFromDoc(pDoc);
	m_GarDec.LoadFromDoc(pDoc);
	m_Vect.LoadFromDoc(pDoc);
	m_RM.LoadFromDoc(pDoc);
	m_Primes.LoadFromDoc(pDoc);
	m_Pourc.LoadFromDoc(pDoc);
	m_Reduct.LoadFromDoc(pDoc);

	m_pDoc = pDoc;
}

void CPropSheetPR::SaveToDocument(CAssuranceCollDoc* pDoc)
{
	m_AgeRet.SaveToDoc(pDoc);
	m_AssVie.SaveToDoc(pDoc);
	m_BM.SaveToDoc(pDoc);
	m_Eval.SaveToDoc(pDoc);
	m_FrTx.SaveToDoc(pDoc);
	m_GarDec.SaveToDoc(pDoc);
	m_Vect.SaveToDoc(pDoc);
	m_RM.SaveToDoc(pDoc);
	m_Primes.SaveToDoc(pDoc);
	m_Pourc.SaveToDoc(pDoc);
	m_Reduct.SaveToDoc(pDoc);
}

void CPropSheetPR::OnApply() 
{
	if(m_AgeRet)
	{
		m_AgeRet.UpdateData(TRUE);
		m_AgeRet.SaveToDoc(m_pDoc);
		m_AgeRet.SetModified(FALSE);
	}
	if(m_AssVie)
	{
		m_AssVie.UpdateData(TRUE);
		m_AssVie.SaveToDoc(m_pDoc);
		m_AssVie.SetModified(FALSE);
	}
	if(m_BM)
	{
		m_BM.UpdateData(TRUE);
		m_BM.SaveToDoc(m_pDoc);
		m_BM.SetModified(FALSE);
	}
	if(m_Eval)
	{
		m_Eval.UpdateData(TRUE);
		m_Eval.SaveToDoc(m_pDoc);
		m_Eval.SetModified(FALSE);
	}
	if(m_FrTx)
	{
		m_FrTx.UpdateData(TRUE);
		m_FrTx.SaveToDoc(m_pDoc);
		m_FrTx.SetModified(FALSE);
	}
	if(m_GarDec)
	{
		m_GarDec.UpdateData(TRUE);
		m_GarDec.SaveToDoc(m_pDoc);
		m_GarDec.SetModified(FALSE);
	}
	if(m_Vect)
	{
		m_Vect.UpdateData(TRUE);
		m_Vect.SaveToDoc(m_pDoc);
		m_Vect.SetModified(FALSE);
	}
	if(m_RM)
	{
		m_RM.UpdateData(TRUE);
		m_RM.SaveToDoc(m_pDoc);
		m_RM.SetModified(FALSE);
	}
	if(m_Primes)
	{
		m_Primes.UpdateData(TRUE);
		m_Primes.SaveToDoc(m_pDoc);
		m_Primes.SetModified(FALSE);
	}
	if(m_Pourc)
	{
		m_Pourc.UpdateData(TRUE);
		m_Pourc.SaveToDoc(m_pDoc);
		m_Pourc.SetModified(FALSE);
	}
	if(m_Reduct)
	{
		m_Reduct.UpdateData(TRUE);
		m_Reduct.SaveToDoc(m_pDoc);
		m_Reduct.SetModified(FALSE);
	}
}


Now here's the code for the cproppage :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#if !defined(AFX_PROPPAGEPRREDUCT_H__6E96BAFC_D9D1_4C06_8513_C781BD884EA3__INCLUDED_)
#define AFX_PROPPAGEPRREDUCT_H__6E96BAFC_D9D1_4C06_8513_C781BD884EA3__INCLUDED_

#include "AssuranceCollDoc.h"

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// PropPagePRReduct.h : header file
//

/////////////////////////////////////////////////////////////////////////////
// CPropPagePRReduct dialog

class CPropPagePRReduct : public CPropertyPage
{
	DECLARE_DYNCREATE(CPropPagePRReduct)

// Construction
public:
	CPropPagePRReduct();
	~CPropPagePRReduct();

	void LoadFromDoc(CAssuranceCollDoc *pDoc);
	void SaveToDoc(CAssuranceCollDoc *pDoc);

// Dialog Data
	//{{AFX_DATA(CPropPagePRReduct)
	enum { IDD = IDD_PROPPAGE_PR_REDUCT };
	double	m_REDPOUR1;
	//}}AFX_DATA


// Overrides
	// ClassWizard generate virtual function overrides
	//{{AFX_VIRTUAL(CPropPagePRReduct)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	// Generated message map functions
	//{{AFX_MSG(CPropPagePRReduct)
		// NOTE: the ClassWizard will add member functions here
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()

};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_PROPPAGEPRREDUCT_H__6E96BAFC_D9D1_4C06_8513_C781BD884EA3__INCLUDED_)


And
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// PropPagePRReduct.cpp : implementation file
//

#include "stdafx.h"
#include "AssuranceColl.h"
#include "PropPagePRReduct.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CPropPagePRReduct property page

IMPLEMENT_DYNCREATE(CPropPagePRReduct, CPropertyPage)

CPropPagePRReduct::CPropPagePRReduct() : CPropertyPage(CPropPagePRReduct::IDD,IDS_PR_REDUCT)
{
	//{{AFX_DATA_INIT(CPropPagePRReduct)
	m_REDPOUR1 = 0.0;
	//}}AFX_DATA_INIT
}

CPropPagePRReduct::~CPropPagePRReduct()
{
}

void CPropPagePRReduct::DoDataExchange(CDataExchange* pDX)
{
	CPropertyPage::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CPropPagePRReduct)
	DDX_Text(pDX, IDC_REDPOUR1, m_REDPOUR1);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CPropPagePRReduct, CPropertyPage)
	//{{AFX_MSG_MAP(CPropPagePRReduct)
		// NOTE: the ClassWizard will add message map macros here
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CPropPagePRReduct message handlers

void CPropPagePRReduct::LoadFromDoc(CAssuranceCollDoc *pDoc)
{
}

void CPropPagePRReduct::SaveToDoc(CAssuranceCollDoc *pDoc)
{
}


Browsing through the tabs (including the reduct tab) works just fine. As soon as I exit the propsheet (ok or cancel), it causes an error :

Debug Error!
Program: ....
DAMAGE: after Client blcok (#337) at 0x00BE7DF0

and debug gives

The thread 0xF38 has exited with code 0 (0x0).
The thread 0xDC4 has exited with code -2147483645 (0x80000003).

What did i do wrong? I googled this error and found something about memory overload... but no solution...

Any ideas?
Anyone?
Topic archived. No new replies allowed.