www.gusucode.com > VC实现基于串口通讯的食堂饭卡系统,需要和相应的 > VC实现基于串口通讯的食堂饭卡系统,需要和相应的硬件结合实现/饭卡系统/DlgModifyFee.cpp

    // DlgModifyFee.cpp : implementation file
//

#include "stdafx.h"
#include "ShoolCard.h"
#include "DlgModifyFee.h"

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

/////////////////////////////////////////////////////////////////////////////
// CDlgModifyFee dialog


CDlgModifyFee::CDlgModifyFee(CWnd* pParent /*=NULL*/)
	: CDialog(CDlgModifyFee::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDlgModifyFee)
	m_ErrorMoney = 0.0f;
	m_RealMoney = 0.0f;
	//}}AFX_DATA_INIT
}


void CDlgModifyFee::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDlgModifyFee)
	DDX_Text(pDX, IDC_EDIT_ERROR, m_ErrorMoney);
	DDX_Text(pDX, IDC_EDIT_REAL, m_RealMoney);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CDlgModifyFee, CDialog)
	//{{AFX_MSG_MAP(CDlgModifyFee)
	ON_WM_SHOWWINDOW()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDlgModifyFee message handlers

void CDlgModifyFee::OnOK() 
{
	// TODO: Add extra validation here
	UpdateData(CON2VAR);
	if(m_RealMoney >= m_ErrorMoney) 
	{
	    MessageBox("数据输入错误!");
		CWnd *pWnd = GetDlgItem(IDC_EDIT_REAL);
		pWnd->SetFocus();
	}
	else
	{
	    CDialog::OnOK(); 
	}
}

void CDlgModifyFee::OnShowWindow(BOOL bShow, UINT nStatus) 
{
	CDialog::OnShowWindow(bShow, nStatus);
	UpdateData(VAR2CON); //
	// TODO: Add your message handler code here
	
}