MSDN Home >  MSDN Library >  User Interface Design and Development >  Windows Shell >  Windows Controls >  Individual Control Information
Rich Edit Controls.zip   (300 k)

Rich Edit Controls  


This section contains information about the programming elements used with rich edit controls. A rich edit control is a window in which the user can enter, edit, format, print, and save text. The text can be assigned character and paragraph formatting, and can include embedded Component Object Model (COM) objects. Rich edit controls support almost all of the messages and notification messages used with multiline edit controls. Thus, applications that already use edit controls can be easily changed to use rich edit controls. Additional messages and notifications enable applications to access the functionality unique to rich edit controls. Beginning with Microsoft Rich Edit 2.0, there is also single line or multiline capabilities and plain or rich text. For information about edit controls, see Edit Controls.

Overviews

About Rich Edit Controls

This section discusses rich edit controls.

Functions

EditStreamCallback

The EditStreamCallback function is an application defined callback function used with the EM_STREAMIN and EM_STREAMOUT messages. It is used to transfer a stream of data into or out of a rich edit control. The EDITSTREAMCALLBACK type defines a pointer to this callback function. EditStreamCallback is a placeholder for the application-defined function name.

EditWordBreakProcEx

The EditWordBreakProcEx function is an application definedcallback function used with the EM_SETWORDBREAKPROCEX message. It determines the character index of the word break or the character class and word-break flags of the characters in the specified text. The EDITWORDBREAKPROCEX type defines a pointer to this callback function. EditWordBreakProcEx is a placeholder for the application-defined function name.

HyphenateProc

The HyphenateProc function is an applicationdefined callback function used with the EM_SETHYPHENATEINFO message. It determines how hyphenation is done in a Rich Edit control.

HyphenateProc is a placeholder for the application

Interfaces

IRichEditOle

The IRichEditOle interface specifies an interface used by the client of a rich text edit control to carry out OLE-related operations. The IRichEditOle interface also supports the ITextDocument interface. For more information on this, see Interface from Window Messages.

Note   A client must release an IRichEditOle pointer before destroying an instance of RichEdit.

The IRichEditOle interface has the following methods.

IRichEditOleCallback

The IRichEditOleCallback interface specifies an interface used by a rich text edit control to retrieve OLE-related information from its client. A rich edit control client is responsible for implementing this interface and assigning it to the control by using the EM_SETOLECALLBACK message. The IRichEditOleCallback interface has the following methods.

Messages

EM_AUTOURLDETECT

An EM_AUTOURLDETECT message enables or disables automatic detection of URLs by a rich edit control.

EM_CANPASTE

The EM_CANPASTE message determines whether a rich edit control can paste a specified clipboard format.

EM_CANREDO

The EM_CANREDO message determines whether there are any actions in the control redo queue.

EM_DISPLAYBAND

The EM_DISPLAYBAND message displays a portion of the contents of a rich edit control, as previously formatted for a device using the EM_FORMATRANGE message.

EM_EXGETSEL

The EM_EXGETSEL message retrieves the starting and ending character positions of the selection in a rich edit control.

EM_EXLIMITTEXT

The EM_EXLIMITTEXT message sets an upper limit to the amount of text the user can type or paste into a rich edit control.

EM_EXLINEFROMCHAR

The EM_EXLINEFROMCHAR message determines which line contains the specified character in a rich edit control.

EM_EXSETSEL

The EM_EXSETSEL message selects a range of characters and/or COM objects in a Rich Edit control.

EM_FINDTEXT

The EM_FINDTEXT message finds text within a rich edit control.

EM_FINDTEXTEX

The EM_FINDTEXTEX message finds text within a rich edit control.

EM_FINDTEXTEXW

The EM_FINDTEXTEXW message is the Unicode version of the EM_FINDTEXTEX message It is used to locate text within the edit control.

EM_FINDTEXTW

The EM_FINDTEXTW message is the Unicode version of the EM_FINDTEXT message. It is used to locate text within the edit control.

EM_FINDWORDBREAK

The EM_FINDWORDBREAK message finds the next word break before or after the specified character position or retrieves information about the character at that position.

EM_FORMATRANGE

The EM_FORMATRANGE message formats a range of text in a rich edit control for a specific device.

EM_GETAUTOURLDETECT

The EM_GETAUTOURLDETECT message indicates whether the auto URL detection is turned on in the rich edit control.

EM_GETBIDIOPTIONS

The EM_GETBIDIOPTIONS message indicates the current state of the bidirectional options in the rich edit control.

EM_GETCHARFORMAT

The EM_GETCHARFORMAT message determines the current character formatting in a rich edit control.

EM_GETCTFMODEBIAS

An application sends a EM_GETCTFMODEBIAS message to get the Text Services Framework mode bias values for a Rich Edit control.

EM_GETCTFOPENSTATUS

An application sends an EM_GETCTFOPENSTATUS message to determine if the Text Services Framework (TSF) keyboard is open or closed.

EM_GETEDITSTYLE

The EM_GETEDITSTYLE message retrieves the current edit style flags.

EM_GETEVENTMASK

The EM_GETEVENTMASK message retrieves the event mask for a rich edit control. The event mask specifies which notification messages the control sends to its parent window.

EM_GETHYPHENATEINFO

An application sends an EM_GETHYPHENATEINFO message to get information about hyphenation for a Rich Edit control.

EM_GETIMECOLOR

The EM_GETIMECOLOR message retrieves the Input Method Editor (IME) composition color. This message is available only in Asian-language versions of the operating system.

EM_GETIMECOMPMODE

An application sends an EM_GETIMECOMPMODE message to get the current IME mode for a rich edit control.

EM_GETIMECOMPTEXT

An application sends an EM_GETIMECOMPTEXT message to get the IME composition text.

EM_GETIMEMODEBIAS

An application sends an EM_GETIMEMODEBIAS message to get the IME mode bias for a Rich Edit control.

EM_GETIMEOPTIONS

The EM_GETIMEOPTIONS message retrieves the current IME options. This message is available only in Asian-language versions of the operating system.

EM_GETIMEPROPERTY

An application sends a EM_GETIMEPROPERTY message to get the the property and capabilities of the IME associated with the current input locale.

EM_GETLANGOPTIONS

An application sends an EM_GETLANGOPTIONS message to get a rich edit control's option settings for IME and Asian language support.

EM_GETOLEINTERFACE

The EM_GETOLEINTERFACE message retrieves an IRichEditOle object that a client can use to access a rich edit control's COM functionality.

EM_GETOPTIONS

The EM_GETOPTIONS message retrieves rich edit control options.

EM_GETPAGEROTATE

Deprecated. An application sends an EM_GETPAGEROTATE message to get the text layout for a Rich Edit control.

EM_GETPARAFORMAT

The EM_GETPARAFORMAT message retrieves the paragraph formatting of the current selection in a rich edit control.

EM_GETPUNCTUATION

The EM_GETPUNCTUATION message gets the current punctuation characters for the rich edit control. This message is available only in Asian-language versions of the operating system.

EM_GETREDONAME

An application sends an EM_GETREDONAME message to a rich edit control to retrieve the type of the next action, if any, in the control's redo queue.

To send this message, call the SendMessage function with the following parameters.

EM_GETSCROLLPOS

An application sends an EM_GETSCROLLPOS message to obtain the current scroll position of the edit control.

EM_GETSELTEXT

The EM_GETSELTEXT message retrieves the currently selected text in a rich edit control.

EM_GETTEXTEX

The EM_GETTEXTEX message allows you to get all of the text from the rich edit control in any particular code base you want.

EM_GETTEXTLENGTHEX

The EM_GETTEXTLENGTHEX message calculates text length in various ways. It is usually called before creating a buffer to receive the text from the control.

EM_GETTEXTMODE

An application sends an EM_GETTEXTMODE message to get the current text mode and undo level of a rich edit control.

EM_GETTEXTRANGE

The EM_GETTEXTRANGE message retrieves a specified range of characters from a rich edit control.

EM_GETTYPOGRAPHYOPTIONS

The EM_GETTYPOGRAPHYOPTIONS message returns the current state of the typography options of a rich edit control.

EM_GETUNDONAME

Rich Edit 2.0 and later: An application sends an EM_GETUNDONAME message to a rich edit control to retrieve the type of the next undo action, if any.

Rich Edit 1.0: This message is not supported.

To send this message, call the SendMessage function with the following parameters.

EM_GETWORDBREAKPROCEX

The EM_GETWORDBREAKPROCEX message retrieves the address of the currently registered extended word-break procedure.

EM_GETWORDWRAPMODE

The EM_GETWORDWRAPMODE message gets the current word wrap and word-break options for the rich edit control. This message is available only in Asian-language versions of the operating system.

EM_GETZOOM

The EM_GETZOOM message gets the current zoom ratio, which is always between 1/64 and 64.

EM_HIDESELECTION

The EM_HIDESELECTION message hides or shows the selection in a rich edit control.

EM_ISIME

An application sends a EM_ISIME message to determine if current input locale is an East Asian locale.

EM_PASTESPECIAL

The EM_PASTESPECIAL message pastes a specific clipboard format in a rich edit control.

EM_RECONVERSION

The EM_RECONVERSION message invokes the IME reconversion dialog box.

EM_REDO

Send an EM_REDO message to a rich edit control to redo the next action in the control's redo queue.

EM_REQUESTRESIZE

The EM_REQUESTRESIZE message forces a rich edit control to send an EN_REQUESTRESIZE notification message to its parent window.

EM_SELECTIONTYPE

The EM_SELECTIONTYPE message determines the selection type for a rich edit control.

EM_SETBIDIOPTIONS

The EM_SETBIDIOPTIONS message sets the current state of the bidirectional options in the rich edit control.

EM_SETBKGNDCOLOR

The EM_SETBKGNDCOLOR message sets the background color for a rich edit control.

EM_SETCHARFORMAT

The EM_SETCHARFORMAT message sets character formatting in a rich edit control.

EM_SETCTFMODEBIAS

An application sends an EM_SETCTFMODEBIAS message to set the Text Services Framework (TSF) mode bias for a Rich Edit control.

EM_SETCTFOPENSTATUS

An application sends an EM_SETCTFOPENSTATUS message to open or close the Text Services Framework (TSF) keyboard.

EM_SETEDITSTYLE

The EM_SETEDITSTYLE message sets the current edit style flags.

EM_SETEVENTMASK

The EM_SETEVENTMASK message sets the event mask for a rich edit control. The event mask specifies which notification messages the control sends to its parent window.

EM_SETFONTSIZE

The EM_SETFONTSIZE message sets the font size for the selected text.

EM_SETHYPHENATEINFO

An application sends an EM_SETHYPHENATEINFO message to set the way a Rich Edit control does hyphenation.

EM_SETIMECOLOR

The EM_SETIMECOLOR message sets the IME composition color. This message is available only in Asian-language versions of the operating system.

EM_SETIMEMODEBIAS

An application sends an EM_SETIMEMODEBIAS message to set the IME mode bias for a Rich Edit control.

EM_SETIMEOPTIONS

The EM_SETIMEOPTIONS message sets the IME options. This message is available only in Asian-language versions of the operating system.

EM_SETLANGOPTIONS

An application sends an EM_SETLANGOPTIONS message to set options for IME and Asian language support in a rich edit control.

EM_SETOLECALLBACK

The EM_SETOLECALLBACK message gives a rich edit control an IRichEditOleCallback object that the control uses to get OLE-related resources and information from the client.

EM_SETOPTIONS

The EM_SETOPTIONS message sets the options for a rich edit control.

EM_SETPAGEROTATE

Deprecated. An application sends an EM_SETPAGEROTATE message to set the text layout for a Rich Edit control.

EM_SETPALETTE

An application sends an EM_SETPALETTE message to change the palette that rich edit uses for its display window.

EM_SETPARAFORMAT

The EM_SETPARAFORMAT message sets the paragraph formatting for the current selection in a rich edit control.

EM_SETPUNCTUATION

The EM_SETPUNCTUATION message sets the punctuation characters for a rich edit control. This message is available only in Asian-language versions of the operating system.

EM_SETSCROLLPOS

An application sends an EM_SETSCROLLPOS message to tell the rich edit control to scroll to a particular point.

EM_SETTARGETDEVICE

The EM_SETTARGETDEVICE message sets the target device and line width used for WYSIWYG formatting in a rich edit control.

EM_SETTEXTEX

The EM_SETTEXTEX message combines the functionality of WM_SETTEXT and EM_REPLACESEL and adds the ability to set text using a code page and to use either Rich Text Format (RTF) rich text or plain text.

EM_SETTEXTMODE

An application sends an EM_SETTEXTMODE message to set the text mode or undo level of a rich edit control. The message fails if the control contains any text.

EM_SETTYPOGRAPHYOPTIONS

The EM_SETTYPOGRAPHYOPTIONS message sets the current state of the typography options of a rich edit control.

EM_SETUNDOLIMIT

An application sends an EM_SETUNDOLIMIT message to a rich edit control to set the maximum number of actions that can stored in the undo queue.

EM_SETWORDBREAKPROCEX

The EM_SETWORDBREAKPROCEX message sets the extended word-break procedure.

EM_SETWORDWRAPMODE

The EM_SETWORDWRAPMODE message sets the word-wrapping and word-breaking options for the rich edit control. This message is available only in Asian-language versions of the operating system.

EM_SETZOOM

The EM_SETZOOM message sets the zoom ratio anywhere between 1/64 and 64.

EM_SHOWSCROLLBAR

The EM_SHOWSCROLLBAR message shows or hides one of the scroll bars in the Text Host window.

EM_STOPGROUPTYPING

An application sends an EM_STOPGROUPTYPING message to a rich edit control to stop the control from collecting additional typing actions into the current undo action. The control stores the next typing action, if any, into a new action in the undo queue.

EM_STREAMIN

The EM_STREAMIN message replaces the contents of a rich edit control with a stream of data provided by an application defined

EM_STREAMOUT

The EM_STREAMOUT message causes a rich edit control to pass its contents to an application

Notifications

EN_ALIGNLTR

The EN_ALIGNLTR notification message notifies a rich edit control's parent window that the paragraph direction has changed to left-to-right. A rich edit control sends this notification message in the form of a WM_COMMAND message.

EN_ALIGNRTL

The EN_ALIGNRTL notification message notifies a rich edit control's parent window that the paragraph direction changed to right-to-left. A rich edit control sends this notification message in the form of a WM_COMMAND message.

EN_CORRECTTEXT

The EN_CORRECTTEXT message notifies a rich edit control parent window that a SYV_CORRECT gesture occurred, giving the parent window a chance to cancel correcting the text. A rich edit control sends this notification message in the form of a WM_NOTIFY message.

EN_DRAGDROPDONE

The EN_DRAGDROPDONE notification message notifies a rich edit control's parent window that the drag-and-drop operation has completed. A rich edit control sends this notification message in the form of a WM_NOTIFY message.

EN_DROPFILES

The EN_DROPFILES message notifies a rich edit control parent window that the user is attempting to drop files into the control. A rich edit control sends this notification message in the form of a WM_NOTIFY message when it receives the WM_DROPFILES message.

EN_IMECHANGE

The EN_IMECHANGE message notifies a rich edit control's parent that the IME conversion status has changed. This message is available only for Asian-language versions of the operating system. A rich edit control sends this notification message in the form of a WM_COMMAND message.

EN_LINK

A rich edit control sends EN_LINK messages when it receives various messages, for example, when the user clicks the mouse or when the mouse pointer is over text that has the CFE_LINK effect.

The parent window of the control receives this notification message through a WM_NOTIFY message.

EN_LOWFIRTF

The EN_LOWFIRTF notification message notifies the parent window of a Rich Edit control that an unsupported RTF keyword was received. A Rich Edit control sends this notification message in the form of a WM_NOTIFY message.

EN_MSGFILTER

The EN_MSGFILTER message notifies a rich edit control's parent window of a keyboard or mouse event in the control. A rich edit control sends this notification message in the form of a WM_NOTIFY message.

EN_OBJECTPOSITIONS

The EN_OBJECTPOSITIONS notification message notifies a rich edit control's parent window when the control reads in objects. A rich edit control sends this notification message in the form of a WM_NOTIFY message.

EN_OLEOPFAILED

The EN_OLEOPFAILED message notifies a rich edit control's parent window that a user action on a COM object has failed. A rich edit control sends this notification message in the form of a WM_NOTIFY message.

EN_PROTECTED

The EN_PROTECTED message notifies a rich edit control's parent window that the user is taking an action that would change a protected range of text. A rich edit control sends this notification message in the form of a WM_NOTIFY message.

EN_REQUESTRESIZE

The EN_REQUESTRESIZE message notifies a rich edit control's parent window that the control's contents are either smaller or larger than the control's window size. A rich edit control sends this notification message in the form of a WM_NOTIFY message.

EN_SAVECLIPBOARD

The EN_SAVECLIPBOARD message notifies the rich edit control's parent window that the control is closing and the clipboard contains information. A rich edit control sends this notification message in the form of a WM_NOTIFY message.

EN_SELCHANGE

The EN_SELCHANGE message notifies a rich edit control's parent window that the current selection has changed. A rich edit control sends this notification message in the form of a WM_NOTIFY message.

EN_STOPNOUNDO

The EN_STOPNOUNDO message notifies a rich edit control's parent window that an action occurred for which the control cannot allocate enough memory to maintain the undo state. A rich edit control sends this notification message in the form of a WM_NOTIFY message.

Structures

BIDIOPTIONS

The BIDIOPTIONS structure contains bidirectional information about a rich edit control. This structure is used by the EM_GETBIDIOPTIONS and EM_SETBIDIOPTIONS messages to get and set the bidirectional information for a control.

CHARFORMAT

The CHARFORMAT structure contains information about character formatting in a rich edit control.

Rich Edit 2.0: The CHARFORMAT2 structure is a Rich Edit 2.0 extension of the CHARFORMAT structure. Rich Edit 2.0 and later allows you to use either structure with the EM_GETCHARFORMAT and EM_SETCHARFORMAT messages.

CHARFORMAT2

The CHARFORMAT2 structure contains information about character formatting in a rich edit control. CHARFORMAT2 is a Rich Edit 2.0 extension of the CHARFORMAT structure. Rich Edit 2.0 allows you to use either structure with the EM_GETCHARFORMAT and EM_SETCHARFORMAT messages.

CHARRANGE

The CHARRANGE structure specifies a range of characters in a rich edit control. This structure is used with the EM_EXGETSEL and EM_EXSETSEL messages.

If the cpMin and cpMax members are equal, the range is empty. The range includes everything if cpMin is 0 and cpMax is

COMPCOLOR

The COMPCOLOR structure contains color settings for a composition string.

EDITSTREAM

The EDITSTREAM structure contains information that an application passes to a rich edit control in a EM_STREAMIN or EM_STREAMOUT message. The rich edit control uses the information to transfer a stream of data into or out of the control.

ENCORRECTTEXT

The ENCORRECTTEXT structure contains information about the selected text to be corrected.

ENDROPFILES

The ENDROPFILES structure contains information associated with an EN_DROPFILES notification message. A rich edit control sends this notification message when it receives a WM_DROPFILES message.

ENLINK

The ENLINK structure contains information about an EN_LINK notification message from a rich edit control.

ENLOWFIRTF

The ENLOWFIRTF structure contains information about an unsupported RTF keyword in a Rich Edit control.

ENOLEOPFAILED

The ENOLEOPFAILED structure contains information about a failed operation.

ENPROTECTED

The ENPROTECTED structure contains information associated with an EN_PROTECTED notification message. A rich edit control sends this notification when the user attempts to edit protected text.

ENSAVECLIPBOARD

The ENSAVECLIPBOARD structure contains information about objects and text on the clipboard.

FINDTEXT

The FINDTEXT structure contains information about a search operation in a rich edit control. This structure is used with the EM_FINDTEXT message.

FINDTEXTEX

The FINDTEXTEX structure contains information about text to search for in a rich edit control. This structure is used with the EM_FINDTEXTEX message.

FORMATRANGE

The FORMATRANGE structure contains information that a rich edit control uses to format its output for a particular device. This structure is used with the EM_FORMATRANGE message.

GETTEXTEX

The GETTEXTEX structure contains information about an operation to get text from a rich edit control. This structure is passed in the wParam in the EM_GETTEXTEX message.

GETTEXTLENGTHEX

The GETTEXTLENGTHEX structure contains information about how the text length of a rich edit control should be calculated. This structure is passed in the wParam in the EM_GETTEXTLENGTHEX message.

HYPHENATEINFO

The HYPHENATEINFO structure contains information about hyphenation in a Rich Edit control.

HYPHRESULT

The HYPHRESULT structure contains information about the result of hyphenation in a Rich Edit control.

IMECOMPTEXT

The IMECOMPTEXT structure contains information about the composition text in a Rich Edit control.

MSGFILTER

The MSGFILTER structure contains information about a keyboard or mouse event. A rich edit control sends this structure to its parent window as part of an EN_MSGFILTER notification message, enabling the parent to change the message or prevent it from being processed.

OBJECTPOSITIONS

The OBJECTPOSITIONS structure contains object position information.

PARAFORMAT

The PARAFORMAT structure contains information about paragraph formatting attributes in a rich edit control. This structure is used with the EM_GETPARAFORMAT and EM_SETPARAFORMAT messages.

In Rich Edit 2.0, the PARAFORMAT2 structure is a Rich Edit 2.0 extension of the PARAFORMAT structure. Rich Edit 2.0 allows you to use either structure with EM_GETPARAFORMAT and EM_SETPARAFORMAT.

PARAFORMAT2

The PARAFORMAT2 structure contains information about paragraph formatting attributes in a rich edit control. PARAFORMAT2 is a Rich Edit 2.0 extension of the PARAFORMAT structure. Rich Edit 2.0 allows you to use either structure with the EM_GETPARAFORMAT and EM_SETPARAFORMAT messages.

PUNCTUATION

The PUNCTUATION structure contains information about the punctuation used in a rich edit control.

REOBJECT

The REOBJECT structure contains information about an object.

REPASTESPECIAL

The REPASTESPECIAL structure contains information identifying whether the display aspect of a pasted object should be based on the content of the object or the icon that represent the object.

REQRESIZE

The REQRESIZE structure contains the requested size of a rich edit control. A rich edit control sends this structure to its parent window as part of an EN_REQUESTRESIZE notification message.

SELCHANGE

The SELCHANGE structure contains information associated with an EN_SELCHANGE notification message. A rich edit control sends this notification to its parent window when the current selection changes.

SETTEXTEX

The SETTEXTEX structure specifies which code page (if any) to use in setting text, whether the text replaces all the text in the control or just the selection, and whether the undo state is to be preserved.

TEXTRANGE

The TEXTRANGE structure receives a range of text from a rich edit control. This structure is filled in by the EM_GETTEXTRANGE message. The buffer pointed to by the lpstrText member must be large enough to receive all characters and the terminating null character.

Constants

Rich Edit Control Event Mask Flags

The event mask specifies which notification messages a rich edit control sends to its parent window. The event mask can be none or a combination of these values.

Rich Edit Control Styles

The following window styles are unique to rich edit controls.