www.pudn.com > ɨÀ×Ô´Âë.rar > RecordDlg.cpp


// RecordDlg.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "Mine.h" 
#include "RecordDlg.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CRecordDlg dialog 
 
extern CMineApp theApp; 
 
CRecordDlg::CRecordDlg(CWnd* pParent /*=NULL*/) 
	: CDialog(CRecordDlg::IDD, pParent) 
{ 
	//{{AFX_DATA_INIT(CRecordDlg) 
	 
	//}}AFX_DATA_INIT 
 
	if(theApp.uGameLevel == LEVEL_PRIMARY) 
	{ 
		m_name = theApp.sPrimaryRecordHolder; 
		m_message = theApp.sResource[2]; 
	} 
	else if(theApp.uGameLevel == LEVEL_SECONDARY) 
	{ 
		m_name = theApp.sSecondaryRecordHolder; 
		m_message = theApp.sResource[3]; 
	} 
	else if(theApp.uGameLevel == LEVEL_ADVANCED) 
	{ 
		m_name = theApp.sAdvancedRecordHolder; 
		m_message = theApp.sResource[4]; 
	} 
} 
 
 
void CRecordDlg::DoDataExchange(CDataExchange* pDX) 
{ 
	CDialog::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(CRecordDlg) 
	DDX_Text(pDX, ID_EDIT_NAME, m_name); 
	DDV_MaxChars(pDX, m_name, 25); 
	DDX_Text(pDX, ID_TEXT, m_message); 
	//}}AFX_DATA_MAP 
} 
 
 
BEGIN_MESSAGE_MAP(CRecordDlg, CDialog) 
	//{{AFX_MSG_MAP(CRecordDlg) 
	ON_BN_CLICKED(ID_BT_OK, OnOk) 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CRecordDlg message handlers 
 
void CRecordDlg::OnOk()  
{	 
	CDialog::OnOK(); 
 
	if(theApp.uGameLevel == LEVEL_PRIMARY) 
	{ 
		theApp.sPrimaryRecordHolder = m_name; 
	} 
	else if(theApp.uGameLevel == LEVEL_SECONDARY) 
	{ 
		theApp.sSecondaryRecordHolder = m_name; 
	} 
	else if(theApp.uGameLevel == LEVEL_ADVANCED) 
	{ 
		theApp.sAdvancedRecordHolder = m_name; 
	} 
}