www.pudn.com > MiniFox.rar > Choice.cpp


// Choice.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "MiniFox.h" 
#include "Choice.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CReceipt property page 
 
IMPLEMENT_DYNCREATE(CReceipt, CPropertyPage) 
 
CReceipt::CReceipt() : CPropertyPage(CReceipt::IDD) 
{ 
	//{{AFX_DATA_INIT(CReceipt) 
		// NOTE: the ClassWizard will add member initialization here 
	//}}AFX_DATA_INIT 
} 
 
CReceipt::~CReceipt() 
{ 
} 
 
BOOL CReceipt::OnCommand (WPARAM wParam,LPARAM lParam) 
{ 
	SetModified(TRUE); 
	return CPropertyPage::OnCommand (wParam,lParam); 
} 
 
void CReceipt::DoDataExchange(CDataExchange* pDX) 
{ 
	CPropertyPage::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(CReceipt) 
		// NOTE: the ClassWizard will add DDX and DDV calls here 
	//}}AFX_DATA_MAP 
} 
 
 
BEGIN_MESSAGE_MAP(CReceipt, CPropertyPage) 
	//{{AFX_MSG_MAP(CReceipt) 
		// NOTE: the ClassWizard will add message map macros here 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CReceipt message handlers 
///////////////////////////////////////////////////////////////////////////// 
// CSystemProperty 
 
IMPLEMENT_DYNAMIC(CSystemProperty, CPropertySheet) 
 
CSystemProperty::CSystemProperty(UINT nIDCaption, CWnd* pParentWnd, UINT iSelectPage) 
	:CPropertySheet(nIDCaption, pParentWnd, iSelectPage) 
{ 
} 
 
CSystemProperty::CSystemProperty(LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectPage) 
	:CPropertySheet(pszCaption, pParentWnd, iSelectPage) 
{ 
	AddPage(&m_receipt); 
} 
 
CSystemProperty::~CSystemProperty() 
{ 
} 
 
 
BEGIN_MESSAGE_MAP(CSystemProperty, CPropertySheet) 
	//{{AFX_MSG_MAP(CSystemProperty) 
		// NOTE - the ClassWizard will add and remove mapping macros here. 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CSystemProperty message handlers 
 
///////////////////////////////////////////////////////////////////////////// 
// CAccountInfo dialog 
 
 
CAccountInfo::CAccountInfo(CWnd* pParent /*=NULL*/) 
: CWizard(CAccountInfo::IDD,pParent) 
{ 
	m_pBitmap1.LoadBitmap(IDB_BITMAP4); 
	m_pBitmap2.LoadBitmap(IDB_BITMAP5); 
	m_pBitmap3.LoadBitmap(IDB_BITMAP6); 
	m_pBitmap4.LoadBitmap(IDB_BITMAP7); 
	//{{AFX_DATA_INIT(CAccountInfo) 
		// NOTE: the ClassWizard will add member initialization here 
	//}}AFX_DATA_INIT 
} 
 
 
void CAccountInfo::DoDataExchange(CDataExchange* pDX) 
{ 
	CDialog::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(CAccountInfo) 
		// NOTE: the ClassWizard will add DDX and DDV calls here 
	//}}AFX_DATA_MAP 
} 
 
 
BEGIN_MESSAGE_MAP(CAccountInfo, CDialog) 
	//{{AFX_MSG_MAP(CAccountInfo) 
	ON_WM_DESTROY() 
	ON_BN_CLICKED(IDC_CLICKED_CANCEL, OnClickedCancel) 
	ON_BN_CLICKED(IDC_CLICKED_OK, OnClickedOK) 
	ON_BN_CLICKED(IDOK, OnOK) 
	ON_BN_CLICKED(IDCANCEL, OnCancel) 
	ON_NOTIFY(LVN_ITEMCHANGED, IDC_LIST1, OnItemchangedList1) 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CAccountInfo message handlers 
 
void CAccountInfo::ShowPage( int nPos ) 
{ 
	PAGELINK* pTemp = m_pPageLink;  
	while( pTemp )  
	{  
		if( pTemp->nNum == nPos)  
		{ 
			pTemp->pDlg->ShowWindow( SW_SHOW ); 
		} 
		else 
			pTemp->pDlg->ShowWindow(SW_HIDE);  
		pTemp = pTemp->Next;  
	} 
	if( nPos >= m_nPageCount )	// The last page. 
	{  
		m_nCurPage = m_nPageCount; 
		return; 
	} 
	if( nPos <= 1 )	// The first page. 
	{ 
		m_nCurPage = 1; 
		return; 
	} 
} 
 
void CAccountInfo::SetWizButton(int nFlag) 
{ 
	GetDlgItem( IDC_CLICKED_CANCEL )->EnableWindow( TRUE );  
	GetDlgItem( IDC_CLICKED_OK )->EnableWindow( TRUE );  
	GetDlgItem( IDC_ACCOUNT_HELP )->EnableWindow( TRUE );  
} 
 
BOOL CAccountInfo::OnInitDialog() 
{ 
	CDialog::OnInitDialog(); 
 
	CRect mainDlgRect;  
	GetWindowRect( &mainDlgRect ); 
	int nCaption = ::GetSystemMetrics( SM_CYCAPTION ); 
	int nXEdge = ::GetSystemMetrics( SM_CXEDGE );   
	int nYEdge = ::GetSystemMetrics( SM_CYEDGE );  
	mainDlgRect.top		= mainDlgRect.top +	nCaption + nYEdge; 
	mainDlgRect.left	= mainDlgRect.left + 2 * nXEdge;  
 
	CRect embDlgRect; 
	GetDlgItem( IDC_OUTPUT )->GetWindowRect( &embDlgRect ); 
 
	m_wndPageRect.top		= embDlgRect.top	- mainDlgRect.top;  
	m_wndPageRect.left		= embDlgRect.left	- mainDlgRect.left;  
	m_wndPageRect.bottom	= embDlgRect.bottom	- mainDlgRect.top;  
	m_wndPageRect.right		= embDlgRect.right	- mainDlgRect.left;  
 
	m_pImage.Create(32,32,ILC_COLOR16,4,4); 
	m_pImage.Add(&m_pBitmap1,RGB(0,0,0)); 
	m_pImage.Add(&m_pBitmap2,RGB(0,0,0)); 
	m_pImage.Add(&m_pBitmap3,RGB(0,0,0)); 
	m_pImage.Add(&m_pBitmap4,RGB(0,0,0)); 
	((CListCtrl*)GetDlgItem(IDC_LIST1))->SetImageList(&m_pImage,LVSIL_SMALL); 
 
	CListCtrl* pLB = (CListCtrl*)GetDlgItem(IDC_LIST1); 
	pLB->InsertItem (0,"个人信息",0); 
//	pLB->InsertItem (1,""); 
	pLB->InsertItem (1,"邮件服务器",1); 
//	pLB->InsertItem (3,""); 
	pLB->InsertItem (2,"发送邮件",2); 
//	pLB->InsertItem (5,""); 
	pLB->InsertItem (3,"接收邮件",3); 
 
	CPersonInfo*  pPerInfo     = new CPersonInfo; 
	CMailServer*  pMailServer  = new CMailServer; 
    CSendMail*    pSendMail    = new CSendMail; 
	CReceiveMail* pReceiveMail = new CReceiveMail; 
 
	AddPage( pPerInfo, IDD_PERSON_INFO ); 
	AddPage( pMailServer, IDD_MAIL_SERVER ); 
	AddPage( pSendMail, IDD_SEND_MAIL ); 
	AddPage( pReceiveMail, IDD_RECEIVE_MAIL ); 
 
	ShowPage(1); 
	return TRUE;  // return TRUE unless you set the focus to a control 
	              // EXCEPTION: OCX Property Pages should return FALSE 
} 
 
 
///////////////////////////////////////////////////////////////////////////// 
// CPersonInfo dialog 
 
 
CPersonInfo::CPersonInfo(CWnd* pParent /*=NULL*/) 
	: CDialog(CPersonInfo::IDD, pParent) 
{ 
	//{{AFX_DATA_INIT(CPersonInfo) 
	m_strName = _T(""); 
	m_strAddress = _T(""); 
	m_MailAdd = _T(""); 
	m_MailSendAdd = _T(""); 
	//}}AFX_DATA_INIT 
} 
 
 
void CPersonInfo::DoDataExchange(CDataExchange* pDX) 
{ 
	CDialog::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(CPersonInfo) 
	DDX_Text(pDX, IDC_EDIT1, m_strName); 
	DDX_Text(pDX, IDC_EDIT2, m_strAddress); 
	DDX_Text(pDX, IDC_EDIT3, m_MailAdd); 
	DDX_Text(pDX, IDC_EDIT4, m_MailSendAdd); 
	//}}AFX_DATA_MAP 
} 
 
 
BEGIN_MESSAGE_MAP(CPersonInfo, CDialog) 
	//{{AFX_MSG_MAP(CPersonInfo) 
		// NOTE: the ClassWizard will add message map macros here 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CPersonInfo message handlers 
 
void CAccountInfo::OnDestroy()  
{ 
	CWizard::OnDestroy(); 
	 
	 
} 
///////////////////////////////////////////////////////////////////////////// 
// CMailServer dialog 
 
 
CMailServer::CMailServer(CWnd* pParent /*=NULL*/) 
	: CDialog(CMailServer::IDD, pParent) 
{ 
	//{{AFX_DATA_INIT(CMailServer) 
		// NOTE: the ClassWizard will add member initialization here 
	//}}AFX_DATA_INIT 
} 
 
 
void CMailServer::DoDataExchange(CDataExchange* pDX) 
{ 
	CDialog::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(CMailServer) 
		// NOTE: the ClassWizard will add DDX and DDV calls here 
	//}}AFX_DATA_MAP 
} 
 
 
BEGIN_MESSAGE_MAP(CMailServer, CDialog) 
	//{{AFX_MSG_MAP(CMailServer) 
	ON_BN_CLICKED(IDC_ADVANCE_SET, OnAdvanceSet) 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CMailServer message handlers 
 
 
///////////////////////////////////////////////////////////////////////////// 
// CSendMail dialog 
 
 
CSendMail::CSendMail(CWnd* pParent /*=NULL*/) 
	: CDialog(CSendMail::IDD, pParent) 
{ 
	//{{AFX_DATA_INIT(CSendMail) 
		// NOTE: the ClassWizard will add member initialization here 
	//}}AFX_DATA_INIT 
} 
 
 
void CSendMail::DoDataExchange(CDataExchange* pDX) 
{ 
	CDialog::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(CSendMail) 
		// NOTE: the ClassWizard will add DDX and DDV calls here 
	//}}AFX_DATA_MAP 
} 
 
 
BEGIN_MESSAGE_MAP(CSendMail, CDialog) 
	//{{AFX_MSG_MAP(CSendMail) 
		// NOTE: the ClassWizard will add message map macros here 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CSendMail message handlers 
///////////////////////////////////////////////////////////////////////////// 
// CReceiveMail dialog 
 
 
CReceiveMail::CReceiveMail(CWnd* pParent /*=NULL*/) 
	: CDialog(CReceiveMail::IDD, pParent) 
{ 
	//{{AFX_DATA_INIT(CReceiveMail) 
		// NOTE: the ClassWizard will add member initialization here 
	//}}AFX_DATA_INIT 
} 
 
 
void CReceiveMail::DoDataExchange(CDataExchange* pDX) 
{ 
	CDialog::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(CReceiveMail) 
		// NOTE: the ClassWizard will add DDX and DDV calls here 
	//}}AFX_DATA_MAP 
} 
 
 
BEGIN_MESSAGE_MAP(CReceiveMail, CDialog) 
	//{{AFX_MSG_MAP(CReceiveMail) 
		// NOTE: the ClassWizard will add message map macros here 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CReceiveMail message handlers 
 
void CAccountInfo::OnOK()  
{ 
	 
	 
} 
 
void CAccountInfo::OnCancel()  
{ 
	CWizard::OnCancel(); 
	 
} 
///////////////////////////////////////////////////////////////////////////// 
// CAdvance dialog 
 
 
CAdvance::CAdvance(CWnd* pParent /*=NULL*/) 
	: CDialog(CAdvance::IDD, pParent) 
{ 
	//{{AFX_DATA_INIT(CAdvance) 
		// NOTE: the ClassWizard will add member initialization here 
	//}}AFX_DATA_INIT 
} 
 
 
void CAdvance::DoDataExchange(CDataExchange* pDX) 
{ 
	CDialog::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(CAdvance) 
		// NOTE: the ClassWizard will add DDX and DDV calls here 
	//}}AFX_DATA_MAP 
} 
 
 
BEGIN_MESSAGE_MAP(CAdvance, CDialog) 
	//{{AFX_MSG_MAP(CAdvance) 
	ON_BN_CLICKED(IDC_CLICKED_OK, OnClickedOk) 
	ON_BN_CLICKED(IDC_CLICKED_CANCEL, OnClickedCancel) 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CAdvance message handlers 
 
void CAdvance::OnClickedOk()  
{ 
	CDialog::OnOK(); 
	 
} 
 
void CAdvance::OnClickedCancel()  
{ 
	CDialog::OnCancel(); 
	 
} 
 
void CMailServer::OnAdvanceSet()  
{ 
	CAdvance ad; 
	ad.DoModal(); 
} 
 
void CAdvance::OnOK()  
{ 
 
} 
 
void CAdvance::OnCancel()  
{ 
	CDialog::OnCancel(); 
} 
 
void CAccountInfo::OnClickedCancel()  
{ 
	CWizard::OnCancel (); 
	 
} 
 
void CAccountInfo::OnClickedOK()  
{ 
	CDialog::OnOK(); 
	 
} 
 
 
void CAccountInfo::OnItemchangedList1(NMHDR* pNMHDR, LRESULT* pResult)  
{ 
	NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR; 
 
	int idx =pNMListView->iItem; 
	switch (idx){ 
	case 0: 
		ShowPage(1); 
		break; 
	case 1: 
		ShowPage(2); 
		break; 
	case 2: 
		ShowPage(3); 
		break; 
	case 3: 
		ShowPage(4); 
		break; 
	default: 
		break; 
	} 
	 
	*pResult = 0; 
}