Export (0) Print
Expand All

Manipulating Text

Windows CE .NET

Windows CE provides four messages for moving text between an edit control and the Clipboard. These four messages apply to both single-line and multiline edit controls. The following table describes these messages.

Message Description
WM_CLEAR Deletes the current selection, if any, from an edit control, but does not copy it to the Clipboard unless a user presses the SHIFT key.
WM_COPY Copies the current selection, if any, from an edit control to the Clipboard without deleting it from the edit control.
WM_CUT Deletes the current selection, if any, in the edit control and copies the deleted text to the Clipboard.
WM_PASTE Copies text from the Clipboard into an edit control at the insertion point.

When a user selects, deletes, or moves text in an edit control, Windows CE maintains an internal flag for each edit control that indicates whether the content of the control has been modified. Windows CE clears this flag when it creates the control and sets the flag when the text in the control is modified. You can retrieve the modification flag by sending the control an EM_GETMODIFY message and set or clear the modification flag by sending the control an EM_SETMODIFY message. These two messages apply to both single-line and multiline edit controls.

The default limit of text that a user can type in an edit control is 30,000 characters. You can change the amount of text that a user can type by sending the control an EM_SETLIMITTEXT message. This message sets a hard limit to the number of bytes that a user can type into an edit control, but affects neither text in the control when the message is sent, nor text that is copied to the control by the SetDlgItemText function or the WM_SETTEXT message. For example, suppose that you use the SetDlgItemText function to place 500 characters in an edit control, and a user also types 500 characters in the edit control, which creates a total of 1,000 characters. If you send an EM_SETLIMITTEXT message that limits user-entered text to 300 characters, the 1,000 characters that are already in the edit control remain there, and a user cannot add any more text. On the other hand, if you send an EM_SETLIMITTEXT message that limits user-entered text to 1,300 characters, the 1,000 characters that are already in the edit control remain there, but a user can add 300 more characters.

When a user reaches the character limit of an edit control, Windows CE sends the application a WM_COMMAND message that contains an EN_MAXTEXT notification message. This notification message does not mean that memory has been exhausted, but that the limit for user-entered text has been reached; a user cannot type any more text. To change this limit, you must send the control a new EM_SETLIMITTEXT message that contains a higher limit.


Last updated on Wednesday, April 13, 2005

© 2005 Microsoft Corporation. All rights reserved.

Show:
© 2015 Microsoft