Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
MFC
Expand Minimize
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

CRichEditCtrl::SetWordCharFormat 

Sets the character formatting attributes for the currently selected word in this CRichEditCtrl object.


BOOL SetWordCharFormat(
   CHARFORMAT& cf 
);
BOOL SetWordCharFormat(
   CHARFORMAT2& cf 
);

Parameters

cf

In the first version, a pointer to a CHARFORMAT structure containing the new character formatting attributes for the currently selected word.

In the second version, a pointer to a CHARFORMAT2 structure, which is a Rich Edit 2.0 extension to the CHARFORMAT structure, containing the new character formatting attributes for the currently selected word.

Nonzero if successful; otherwise, 0.

Only the attributes specified by the dwMask member of cf are changed by this function.

For more information, see the EM_SETCHARFORMAT message and the CHARFORMAT and CHARFORMAT2 structures in the Platform SDK.

// The pointer to my rich edit control.
extern CRichEditCtrl* pmyRichEditCtrl;
CHARFORMAT cf;

// Modify the word format so that the selected word is 
// displayed in bold and not striked out.
cf.dwMask = CFM_STRIKEOUT|CFM_BOLD;
cf.dwEffects = CFE_BOLD;
pmyRichEditCtrl->SetWordCharFormat(cf);

Community Additions

ADD
Show:
© 2015 Microsoft