void CExpendDlg::OnEnChangeEditExpendMoney()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
CString strTemp;
CEdit* pEdit = (CEdit*) GetDlgItem(IDC_EDIT_EXPEND_MONEY);
pEdit->GetWindowText(strTemp);
int start = 0;
int end = 0;
pEdit->GetSel(start, end);
if (end == 0)
{
return;
}
if (strTemp.GetLength() > 0)
{
TCHAR character = strTemp.GetAt(end-1);
if ( ((!(character>='0' && character<='9') && character != '.'))
|| strTemp.Find('.') != strTemp.ReverseFind('.') )
{
int setPos = strTemp.GetLength();
strTemp.Delete(end-1, 1);
pEdit->SetWindowText(strTemp);
pEdit->SetSel(setPos-1,setPos-1);
}
}
}