CEdit SetTextWindow and unhandled Exception

Hi!

I would like to change a text of CEdit programmatically. So my code:
1
2
3
4
5
6
7
8
9
10
11
12
void Cfirst_mfcDlg::OnEnChangeEdit1()
{
	// 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
	
	//myCEdit.GetWindowText(s);		
	myCEdit.SetWindowText(L"sdfsdf");
}


I get unhandled exception on atldebugapi.cpp :( in 11 line.

(My purpose is creating a hex format data reader code which warn if the user types not legal data. So I want to check the typed text and put a message box with warning if the user type for example 'g' letter)

The reading is work with GetWindowText. But the SetWindowText doesn't work.

Thank you.



I have found the solution.. I get infinite loop because the SetWindowText causes calling OnEnChangeEdit1()

So I have to handle this situation.
Topic archived. No new replies allowed.