www.pudn.com > mytest.rar > mytestDlg.cpp


// mytestDlg.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "mytest.h" 
#include "mytestDlg.h" 
 
#include "gameengine.h" 
#include "gamerule.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CAboutDlg dialog used for App About 
 
class CAboutDlg : public CDialog 
{ 
public: 
	CAboutDlg(); 
 
// Dialog Data 
	//{{AFX_DATA(CAboutDlg) 
	enum { IDD = IDD_ABOUTBOX }; 
	//}}AFX_DATA 
 
	// ClassWizard generated virtual function overrides 
	//{{AFX_VIRTUAL(CAboutDlg) 
	protected: 
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support 
	//}}AFX_VIRTUAL 
 
// Implementation 
protected: 
	//{{AFX_MSG(CAboutDlg) 
	//}}AFX_MSG 
	DECLARE_MESSAGE_MAP() 
}; 
 
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD) 
{ 
	//{{AFX_DATA_INIT(CAboutDlg) 
	//}}AFX_DATA_INIT 
} 
 
void CAboutDlg::DoDataExchange(CDataExchange* pDX) 
{ 
	CDialog::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(CAboutDlg) 
	//}}AFX_DATA_MAP 
} 
 
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog) 
	//{{AFX_MSG_MAP(CAboutDlg) 
		// No message handlers 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CMytestDlg dialog 
 
CMytestDlg::CMytestDlg(CWnd* pParent /*=NULL*/) 
	: CDialog(CMytestDlg::IDD, pParent) 
{ 
	//{{AFX_DATA_INIT(CMytestDlg) 
	m_31 = FALSE; 
	m_32 = FALSE; 
	m_33 = FALSE; 
	m_34 = FALSE; 
	m_41 = FALSE; 
	m_42 = FALSE; 
	m_43 = FALSE; 
	m_44 = FALSE; 
	m_51 = FALSE; 
	m_52 = FALSE; 
	m_53 = FALSE; 
	m_54 = FALSE; 
	m_61 = FALSE; 
	m_62 = FALSE; 
	m_63 = FALSE; 
	m_64 = FALSE; 
	m_71 = FALSE; 
	m_72 = FALSE; 
	m_73 = FALSE; 
	m_74 = FALSE; 
	m_81 = FALSE; 
	m_82 = FALSE; 
	m_83 = FALSE; 
	m_84 = FALSE; 
	m_91 = FALSE; 
	m_92 = FALSE; 
	m_93 = FALSE; 
	m_94 = FALSE; 
	m_101 = FALSE; 
	m_102 = FALSE; 
	m_103 = FALSE; 
	m_104 = FALSE; 
	m_J1 = FALSE; 
	m_J2 = FALSE; 
	m_J3 = FALSE; 
	m_J4 = FALSE; 
	m_Q1 = FALSE; 
	m_Q2 = FALSE; 
	m_Q3 = FALSE; 
	m_Q4 = FALSE; 
	m_K1 = FALSE; 
	m_K2 = FALSE; 
	m_K3 = FALSE; 
	m_K4 = FALSE; 
	m_A1 = FALSE; 
	m_A2 = FALSE; 
	m_A3 = FALSE; 
	m_A4 = FALSE; 
	m_21 = FALSE; 
	m_22 = FALSE; 
	m_23 = FALSE; 
	m_24 = FALSE; 
	m_JOK1 = FALSE; 
	m_JOK2 = FALSE; 
	m_ePre = _T(""); 
	m_eNext = _T(""); 
	//}}AFX_DATA_INIT 
	// Note that LoadIcon does not require a subsequent DestroyIcon in Win32 
	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); 
} 
 
void CMytestDlg::DoDataExchange(CDataExchange* pDX) 
{ 
	CDialog::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(CMytestDlg) 
	DDX_Check(pDX, IDC_CHECK1, m_31); 
	DDX_Check(pDX, IDC_CHECK2, m_32); 
	DDX_Check(pDX, IDC_CHECK3, m_33); 
	DDX_Check(pDX, IDC_CHECK4, m_34); 
	DDX_Check(pDX, IDC_CHECK5, m_41); 
	DDX_Check(pDX, IDC_CHECK6, m_42); 
	DDX_Check(pDX, IDC_CHECK7, m_43); 
	DDX_Check(pDX, IDC_CHECK8, m_44); 
	DDX_Check(pDX, IDC_CHECK9, m_51); 
	DDX_Check(pDX, IDC_CHECK10, m_52); 
	DDX_Check(pDX, IDC_CHECK11, m_53); 
	DDX_Check(pDX, IDC_CHECK12, m_54); 
	DDX_Check(pDX, IDC_CHECK13, m_61); 
	DDX_Check(pDX, IDC_CHECK14, m_62); 
	DDX_Check(pDX, IDC_CHECK15, m_63); 
	DDX_Check(pDX, IDC_CHECK16, m_64); 
	DDX_Check(pDX, IDC_CHECK17, m_71); 
	DDX_Check(pDX, IDC_CHECK18, m_72); 
	DDX_Check(pDX, IDC_CHECK19, m_73); 
	DDX_Check(pDX, IDC_CHECK20, m_74); 
	DDX_Check(pDX, IDC_CHECK21, m_81); 
	DDX_Check(pDX, IDC_CHECK22, m_82); 
	DDX_Check(pDX, IDC_CHECK23, m_83); 
	DDX_Check(pDX, IDC_CHECK24, m_84); 
	DDX_Check(pDX, IDC_CHECK25, m_91); 
	DDX_Check(pDX, IDC_CHECK26, m_92); 
	DDX_Check(pDX, IDC_CHECK27, m_93); 
	DDX_Check(pDX, IDC_CHECK28, m_94); 
	DDX_Check(pDX, IDC_CHECK29, m_101); 
	DDX_Check(pDX, IDC_CHECK30, m_102); 
	DDX_Check(pDX, IDC_CHECK31, m_103); 
	DDX_Check(pDX, IDC_CHECK32, m_104); 
	DDX_Check(pDX, IDC_CHECK33, m_J1); 
	DDX_Check(pDX, IDC_CHECK34, m_J2); 
	DDX_Check(pDX, IDC_CHECK35, m_J3); 
	DDX_Check(pDX, IDC_CHECK36, m_J4); 
	DDX_Check(pDX, IDC_CHECK37, m_Q1); 
	DDX_Check(pDX, IDC_CHECK38, m_Q2); 
	DDX_Check(pDX, IDC_CHECK39, m_Q3); 
	DDX_Check(pDX, IDC_CHECK40, m_Q4); 
	DDX_Check(pDX, IDC_CHECK41, m_K1); 
	DDX_Check(pDX, IDC_CHECK42, m_K2); 
	DDX_Check(pDX, IDC_CHECK43, m_K3); 
	DDX_Check(pDX, IDC_CHECK44, m_K4); 
	DDX_Check(pDX, IDC_CHECK45, m_A1); 
	DDX_Check(pDX, IDC_CHECK46, m_A2); 
	DDX_Check(pDX, IDC_CHECK47, m_A3); 
	DDX_Check(pDX, IDC_CHECK48, m_A4); 
	DDX_Check(pDX, IDC_CHECK49, m_21); 
	DDX_Check(pDX, IDC_CHECK50, m_22); 
	DDX_Check(pDX, IDC_CHECK51, m_23); 
	DDX_Check(pDX, IDC_CHECK52, m_24); 
	DDX_Check(pDX, IDC_CHECK53, m_JOK1); 
	DDX_Check(pDX, IDC_CHECK54, m_JOK2); 
	DDX_Text(pDX, IDC_EDIT1, m_ePre); 
	DDX_Text(pDX, IDC_EDIT2, m_eNext); 
	//}}AFX_DATA_MAP 
} 
 
BEGIN_MESSAGE_MAP(CMytestDlg, CDialog) 
	//{{AFX_MSG_MAP(CMytestDlg) 
	ON_WM_SYSCOMMAND() 
	ON_WM_PAINT() 
	ON_WM_QUERYDRAGICON() 
	ON_BN_CLICKED(IDC_Compare, OnCompare) 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CMytestDlg message handlers 
 
BOOL CMytestDlg::OnInitDialog() 
{ 
	CDialog::OnInitDialog(); 
 
	// Add "About..." menu item to system menu. 
 
	// IDM_ABOUTBOX must be in the system command range. 
	ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX); 
	ASSERT(IDM_ABOUTBOX < 0xF000); 
 
	CMenu* pSysMenu = GetSystemMenu(FALSE); 
	if (pSysMenu != NULL) 
	{ 
		CString strAboutMenu; 
		strAboutMenu.LoadString(IDS_ABOUTBOX); 
		if (!strAboutMenu.IsEmpty()) 
		{ 
			pSysMenu->AppendMenu(MF_SEPARATOR); 
			pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu); 
		} 
	} 
 
	// Set the icon for this dialog.  The framework does this automatically 
	//  when the application's main window is not a dialog 
	SetIcon(m_hIcon, TRUE);			// Set big icon 
	SetIcon(m_hIcon, FALSE);		// Set small icon 
	 
	// TODO: Add extra initialization here 
	 
	return TRUE;  // return TRUE  unless you set the focus to a control 
} 
 
void CMytestDlg::OnSysCommand(UINT nID, LPARAM lParam) 
{ 
	if ((nID & 0xFFF0) == IDM_ABOUTBOX) 
	{ 
		CAboutDlg dlgAbout; 
		dlgAbout.DoModal(); 
	} 
	else 
	{ 
		CDialog::OnSysCommand(nID, lParam); 
	} 
} 
 
// If you add a minimize button to your dialog, you will need the code below 
//  to draw the icon.  For MFC applications using the document/view model, 
//  this is automatically done for you by the framework. 
 
void CMytestDlg::OnPaint()  
{ 
	if (IsIconic()) 
	{ 
		CPaintDC dc(this); // device context for painting 
 
		SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0); 
 
		// Center icon in client rectangle 
		int cxIcon = GetSystemMetrics(SM_CXICON); 
		int cyIcon = GetSystemMetrics(SM_CYICON); 
		CRect rect; 
		GetClientRect(&rect); 
		int x = (rect.Width() - cxIcon + 1) / 2; 
		int y = (rect.Height() - cyIcon + 1) / 2; 
 
		// Draw the icon 
		dc.DrawIcon(x, y, m_hIcon); 
	} 
	else 
	{ 
		CDialog::OnPaint(); 
	} 
} 
 
// The system calls this to obtain the cursor to display while the user drags 
//  the minimized window. 
HCURSOR CMytestDlg::OnQueryDragIcon() 
{ 
	return (HCURSOR) m_hIcon; 
} 
 
__int64 CMytestDlg::CombineInt() 
{ 
	__int64 iCombine = 0; 
	__int64 iOne = 1; 
	int i = 0; 
 
	if(m_31) 
	{ 
		iCombine += (iOne << i); 
	} 
	i++; 
	if(m_32) 
	{ 
		iCombine += (iOne << i); 
	} 
	i++; 
	if(m_33) 
	{ 
		iCombine += (iOne << i); 
	} 
	i++; 
	if(m_34) 
	{ 
		iCombine += (iOne << i); 
	} 
	i++; 
	if(m_41) 
	{ 
		iCombine += (iOne << i); 
	} 
	i++; 
	if(m_42) 
	{ 
		iCombine += (iOne << i); 
	} 
	i++; 
	if(m_43) 
	{ 
		iCombine += (iOne << i); 
	} 
	i++; 
	if(m_44) 
	{ 
		iCombine += (iOne << i); 
	} 
	i++; 
	if(m_51) 
	{ 
		iCombine += (iOne << i); 
	} 
	i++; 
	if(m_52) 
	{ 
		iCombine += (iOne << i); 
	} 
	i++; 
	if(m_53) 
	{ 
		iCombine += (iOne << i); 
	} 
	i++; 
	if(m_54) 
	{ 
		iCombine += (iOne << i); 
	} 
	i++; 
	if(m_61) 
	{ 
		iCombine += (iOne << i); 
	} 
	i++; 
	if(m_62) 
	{ 
		iCombine += (iOne << i); 
	} 
	i++; 
	if(m_63) 
	{ 
		iCombine += (iOne << i); 
	} 
	i++; 
	if(m_64) 
	{ 
		iCombine += (iOne << i); 
	} 
	i++; 
	if(m_71) 
	{ 
		iCombine += (iOne << i); 
	} 
	i++; 
	if(m_72) 
	{ 
		iCombine += (iOne << i); 
	} 
	i++; 
	if(m_73) 
	{ 
		iCombine += (iOne << i); 
	} 
	i++; 
	if(m_74) 
	{ 
		iCombine += (iOne << i); 
	} 
	i++; 
	if(m_81) 
	{ 
		iCombine += (iOne << i); 
	} 
	i++; 
	if(m_82) 
	{ 
		iCombine += (iOne << i); 
	} 
	i++; 
	if(m_83) 
	{ 
		iCombine += (iOne << i); 
	} 
	i++; 
	if(m_84) 
	{ 
		iCombine += (iOne << i); 
	} 
	i++; 
	if(m_91) 
	{ 
		iCombine += (iOne << i); 
	} 
	i++; 
	if(m_92) 
	{ 
		iCombine += (iOne << i); 
	} 
	i++; 
	if(m_93) 
	{ 
		iCombine += (iOne << i); 
	} 
	i++; 
	if(m_94) 
	{ 
		iCombine += (iOne << i); 
	} 
	i++; 
	if(m_101) 
	{ 
		iCombine += (iOne << i); 
	} 
	i++; 
	if(m_102) 
	{ 
		iCombine += (iOne << i); 
	} 
	i++; 
	if(m_103) 
	{ 
		iCombine += (iOne << i); 
	} 
	i++; 
	if(m_104) 
	{ 
		iCombine += (iOne << i); 
	} 
	i++; 
	if(m_J1) 
	{ 
		iCombine += (iOne << i); 
	} 
	i++; 
	if(m_J2) 
	{ 
		iCombine += (iOne << i); 
	} 
	i++; 
	if(m_J3) 
	{ 
		iCombine += (iOne << i); 
	} 
	i++; 
	if(m_J4) 
	{ 
		iCombine += (iOne << i); 
	} 
	i++; 
	if(m_Q1) 
	{ 
		iCombine += (iOne << i); 
	} 
	i++; 
	if(m_Q2) 
	{ 
		iCombine += (iOne << i); 
	} 
	i++; 
	if(m_Q3) 
	{ 
		iCombine += (iOne << i); 
	} 
	i++; 
	if(m_Q4) 
	{ 
		iCombine += (iOne << i); 
	} 
	i++; 
	if(m_K1) 
	{ 
		iCombine += (iOne << i); 
	} 
	i++; 
	if(m_K2) 
	{ 
		iCombine += (iOne << i); 
	} 
	i++; 
	if(m_K3) 
	{ 
		iCombine += (iOne << i); 
	} 
	i++; 
	if(m_K4) 
	{ 
		iCombine += (iOne << i); 
	} 
	i++; 
	if(m_A1) 
	{ 
		iCombine += (iOne << i); 
	} 
	i++; 
	if(m_A2) 
	{ 
		iCombine += (iOne << i); 
	} 
	i++; 
	if(m_A3) 
	{ 
		iCombine += (iOne << i); 
	} 
	i++; 
	if(m_A4) 
	{ 
		iCombine += (iOne << i); 
	} 
	i++; 
	if(m_21) 
	{ 
		iCombine += (iOne << i); 
	} 
	i++; 
	if(m_22) 
	{ 
		iCombine += (iOne << i); 
	} 
	i++; 
	if(m_23) 
	{ 
		iCombine += (iOne << i); 
	} 
	i++; 
	if(m_24) 
	{ 
		iCombine += (iOne << i); 
	} 
	i++; 
	if(m_JOK1) 
	{ 
		iCombine += (iOne << i); 
	} 
	i++; 
	if(m_JOK2) 
	{ 
		iCombine += (iOne << i); 
	} 
	return iCombine; 
} 
 
void CMytestDlg::reset() 
{ 
	m_31 = FALSE;	m_32 = FALSE;	m_33 = FALSE;	m_34 = FALSE; 
	m_41 = FALSE;	m_42 = FALSE;	m_43 = FALSE;	m_44 = FALSE; 
	m_51 = FALSE;	m_52 = FALSE;	m_53 = FALSE;	m_54 = FALSE; 
	m_61 = FALSE;	m_62 = FALSE;	m_63 = FALSE;	m_64 = FALSE; 
	m_71 = FALSE;	m_72 = FALSE;	m_73 = FALSE;	m_74 = FALSE; 
	m_81 = FALSE;	m_82 = FALSE;	m_83 = FALSE;	m_84 = FALSE; 
	m_91 = FALSE;	m_92 = FALSE;	m_93 = FALSE;	m_94 = FALSE; 
	m_101 = FALSE;	m_102 = FALSE;	m_103 = FALSE;	m_104 = FALSE; 
	m_J1 = FALSE;	m_J2 = FALSE;	m_J3 = FALSE;	m_J4 = FALSE; 
	m_Q1 = FALSE;	m_Q2 = FALSE;	m_Q3 = FALSE;	m_Q4 = FALSE; 
	m_K1 = FALSE;	m_K2 = FALSE;	m_K3 = FALSE;	m_K4 = FALSE; 
	m_A1 = FALSE;	m_A2 = FALSE;	m_A3 = FALSE;	m_A4 = FALSE; 
	m_21 = FALSE;	m_22 = FALSE;	m_23 = FALSE;	m_24 = FALSE; 
	m_JOK1 = FALSE;	m_JOK2 = FALSE; 
} 
 
void CMytestDlg::OnCompare()  
{ 
	this->UpdateData(); 
 
	this->UpdateData(FALSE); 
} 
 
void CMytestDlg::OnOK()  
{ 
	this->UpdateData(); 
	reset(); 
	m_ePre.Empty(); 
	m_eNext.Empty(); 
	this->UpdateData(FALSE); 
}