// Create a CEdit control CEdit myEdit; myEdit.Create(ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE, CRect(10,10,200,30), pParentWnd, IDC_MY_EDIT); // Set initial text myEdit.SetWindowText(_T("Hello World!"));
// Declare message map for the parent window BEGIN_MESSAGE_MAP(CMyParentWnd, CWnd) ON_EN_CHANGE(IDC_MY_EDIT, OnMyEditChange) END_MESSAGE_MAP() // Handler function for the EN_CHANGE event void CMyParentWnd::OnMyEditChange() { CString strText; myEdit.GetWindowText(strText); // Do something with the new text... }Overall, CEdit is a useful control for text input and manipulation in Windows applications, and it is included in the MFC library in Microsoft Visual Studio.