Bonsoir,
Je souhaietrais utiliser une CPropertySheet afin de pouvoir afficher deux onglets.
Pour cela, dans ma classe CInterface (héritée de CWinApp), je créé une CMainFrame (hérité de CFrameWnd). J'ai redéfini dans CMainFrame la méthode OnViewPropertysheet :
1 2 3 4 5 6 7
| psheet = new MySheet(); // psheet est de type MySheet, une classe héritée de CPropertySheet
psheet->Create(this, WS_CHILD|WS_VISIBLE, WS_CHILD|WS_VISIBLE);
dw = new CDW(); // dw et contexte sont de type CDW, une classe héritée de CPropertyPage
contexte = new CDW();
psheet->AddPage(dw);
psheet->AddPage(contexte);
psheet->DoModal(); |
MySheet.h:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| #ifndef MYSHEET_H
#define MYSHEET_H
#include "StdAfx.h"
class MySheet : public CPropertySheet
{
public:
MySheet();
MySheet(UINT nIDCaption, CWnd* pParentWnd, UINT iSelectPage);
~MySheet();
virtual BOOL OnInitDialog();
protected:
DECLARE_MESSAGE_MAP();
};
#endif |
MySheet.cpp
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
| #include "MySheet.h"
BEGIN_MESSAGE_MAP(MySheet, CPropertySheet)
//{{AFX_MSG_MAP(MySheet)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
MySheet::MySheet()
:CPropertySheet()
{
}
MySheet::MySheet(UINT nIDCaption, CWnd* pParentWnd, UINT iSelectPage)
:CPropertySheet(nIDCaption, pParentWnd, iSelectPage)
{
}
MySheet::~MySheet()
{
}
BOOL MySheet::OnInitDialog()
{
CPropertySheet::OnInitDialog();
return TRUE;
} |
CDW.h
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| #include "StdAfx.h"
#include <vector>
using namespace std;
typedef CEdit * MyCEdit;
// Déclaration de la classe CDW_H
//---------------------------------------------------------
class CDW : public CPropertyPage
{
public:
CDW();
~CDW();
protected:
DECLARE_MESSAGE_MAP();
};
#endif |
CDW.cpp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| #include "CDW.h"
BEGIN_MESSAGE_MAP(CDW, CPropertyPage)
//{{AFX_MSG_MAP(CDW)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
CDW::CDW()
:CPropertyPage()
{
}
CDW::~CDW()
{
} |
Malheureusement, lorsque j'execute mon code, j'obtiens une erreur :
Exception non gérée à 0x76a0b09e dans DataMiner.exe : Exception Microsoft C++ : CResourceException à l'emplacement mémoire 0x0012fe34..
Partager