Q: How do I disable edit features in an edit control?

A: If you want to disable all the edit features of an edit control and still want to access its features like adding / appending a string and display the text in wrapped lines, here is a simple method to do this.

But, before that, about the other easy methods to achieve similar things: One can as well create read only edit control. But the look is different for read only edit controls with background painted as gray. Moreover, one can focus the edit control in the tab order or by clicking on it and the cursor will be shown in the edit control when it is in focus. You can as well disable the edit control since disabled edit controls suppress the cursor and prevents user from selecting it through tab order or by mouse click. But, information displayed cannot be easily read due to the dimmed way text is written. Changing colour of text or appearances of the control is difficult without sub-classing the edit control.

Here is an easier method to make an edit control look as a panel of static information, but still can be treated programmatically as a normal edit control.

The method I used here is to handle the EN_SETFOCUS message in the parent window, of which edit control is a part. In the message handler, I simply set the focus to the parent window itself.

If you are inserting the control using resource editor, you can right-click the control and handle the event of notification message EN_SETFOCUS. If you are programmatically inserting the control, you will have to define the function in the header file

Code:
protected:
	//{{AFX_MSG(CParentWnd)
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnSetfocusMessage();
	//}}AFX_MSG
will have to make the message map entries in your class implementation

Code:
BEGIN_MESSAGE_MAP(CParentWnd, CBaseClass)
	//{{AFX_MSG_MAP(CParentWnd)
	ON_WM_CREATE()
	ON_EN_SETFOCUS(ID_EDIT, OnSetfocusMessage)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()
and finally have to shift the focus from the edit control in the message handler

Code:
void CParentWnd::OnSetfocusMessage() 
{
	// TODO: Add your control notification handler code here
	SetFocus();
}
This works fine as far as prevention of selecting with mouse is concerned. But, when the control is defined in a particular tab order, focus will be simply lost when one presses TAB from the previous control, since focus is on the parent window. Next TAB press will bring the focus to the first control in the tab order. Hence, there will be an abnormality of behaviour. One of the easiest way to solve this is to declare this edit control as the last item in tab order. If there are multiple panels of information like this, they all can be pushed to the last in the tab order.