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 buffer and copies it to the control. The size can be up to a predefined limit of approximately 30,000 characters for single-line edit controls. Because this limit can change, it is called 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 sends the application an EN_ERRSPACE message. You can retrieve the current text limit by sending an EM_GETLIMITTEXT message.

You free the buffer by calling the LocalFree function, or you can obtain a new buffer, and buffer handle, by calling the LocalAlloc function.

You can initialize or reinitialize an edit control's 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, which is 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 whether 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 may have to retrieve the font metrics for the text and recalculate the size of the edit control.