Ask Learn
Preview
Please sign in to use this experience.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Sets character formatting in a rich edit control.
wParam
Character formatting that applies to the control. If this parameter is zero, the default character format is set. Otherwise, it can be one of the following values.
Value | Meaning |
---|---|
|
Applies the formatting to all text in the control. Not valid with SCF_SELECTION or SCF_WORD. |
|
RichEdit 4.1: Associates a font to a given script, thus changing the default font for that script. To specify the font, use the following members of CHARFORMAT2: yHeight, bCharSet, bPitchAndFamily, szFaceName, and lcid. |
|
RichEdit 4.1: Associates a surrogate (plane-2) font to a given script, thus changing the default font for that script. To specify the font, use the following members of CHARFORMAT2: yHeight, bCharSet, bPitchAndFamily, szFaceName, and lcid. |
|
Gets the character repertoire from the LCID. |
|
RichEdit 4.1: Sets the default font for the control. |
|
Prevents setting the default paragraph format when the rich edit control is empty. |
|
RichEdit 4.1: Prevents keyboard switching to match the font. For example, if an Arabic font is set, normally the automatic keyboard feature for Bidi languages changes the keyboard to an Arabic keyboard. |
|
Applies the formatting to the current selection. If the selection is empty, the character formatting is applied to the insertion point, and the new character format is in effect only until the insertion point changes. |
|
Sets the default paragraph formatting attributes. |
|
Apply the font only if it can handle script. |
|
RichEdit 4.1: Used with SCF_SELECTION. Indicates that format came from a toolbar or other UI tool, so UI formatting rules should be used instead of literal formatting. |
|
Applies the formatting to the selected word or words. If the selection is empty but the insertion point is inside a word, the formatting is applied to the word. The SCF_WORD value must be used in conjunction with the SCF_SELECTION value. |
lParam
Pointer to a CHARFORMAT structure specifying the character formatting to use. Only the formatting attributes specified by the dwMask member are changed.
Microsoft Rich Edit 2.0 and later: This parameter can be a pointer to a CHARFORMAT2 structure, which is an extension of the CHARFORMAT structure. Before sending the EM_SETCHARFORMAT message, set the structure's cbSize member to sizeof(CHARFORMAT)
or sizeof(CHARFORMAT2)
indicate which version of the structure is being used.
The szFaceName and bCharSet members may be overruled when invalid for characters, for example: Arial on kanji characters.
If the operation succeeds, the return value is a nonzero value.
If the operation fails, the return value is zero.
If this message is sent more than once with the same parameters, the effect on the text is toggled. That is, sending the message once produces the effect, sending the message twice cancels the effect, and so forth.
Requirement | Value |
---|---|
Minimum supported client |
Windows Vista [desktop apps only] |
Minimum supported server |
Windows Server 2003 [desktop apps only] |
Header |
|
Reference
Please sign in to use this experience.
Sign in