Hi,
This what I am trying to do in an Edit Box: Enter the numbers for a date in an edit box and as I am entering the numbers a forward slash appears at predetermined locations. I type MM and a forward slash appears. Type DD and another slash appears. The end result is mm/dd/yy. I recently used an online application that had such a feature.
I tried using the OnChar() for WM_CHAR but this only deals with the character entered.
I tried using OnChangeEdit for EN_CHANGE but did not get anywhere. What I have below will put a new string in the edit box but the program will lock. Doe anyone have any additional suggestions on how to figure this out.
void CEditSampleDlg::OnChangeEditName()
{
// 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
CEdit* pEdit = (CEdit*)GetDlgItem(IDC_EDIT_NAME);
CString strText;
pEdit->GetWindowText(strText);
int nLength = strText.GetLength();
CString strResult;
strResult.Format("The lenth is %d ", nLength);
AfxMessageBox(strResult);
pEdit->SetWindowText(strResult);
}



LinkBack URL
About LinkBacks


