Modifying the Text Buffer

When Windows CE creates an edit control, it automatically creates a text buffer, sets its initial size, and increases the size as necessary. Windows CE stores edit control text in a text buffer and copies it to the control. The size can be up to a predefined limit of 30,000 characters for single-line edit controls. Because this limit can change, it is a soft limit. You can set a hard limit to the buffer size by sending an EM_SETLIMITTEXT message to the edit control. If the buffer exceeds either limit, Windows CE sends the application an EN_ERRSPACE message. You can retrieve the current text limit by sending an EM_GETLIMITTEXT message.

Free the buffer by calling the LocalFree function, or obtain a new buffer, and buffer handle, by calling the LocalAlloc function.

You can initialize or reinitialize an edit control text buffer by calling the SetDlgItemText function. It can retrieve the content of a text buffer by calling the GetDlgItemText function.

For each edit control, Windows CE maintains a read-only flag that indicates whether the control's text is read/write, the default, or read-only. An application can set the read/write or read-only flag for the text by sending the control an EM_SETREADONLY message. To determine if an edit control is read-only, an application can call the GetWindowLong function using the GWL_STYLE constant. The EM_SETREADONLY message applies to both single-line and multiline edit controls.

You can change the font that an edit control uses by sending the WM_SETFONT message. Changing the font does not change the size of the edit control; applications that send the WM_SETFONT message might have to retrieve the font metrics for the text and recalculate the size of the edit control.