Home > Software engineering >  Set the paragraph format CRichEditCtrl SendMessage return zero!!!!! Be urgent! Selected content
Set the paragraph format CRichEditCtrl SendMessage return zero!!!!! Be urgent! Selected content

Time:11-17

 if (PFS. DoModal ()==IDOK) {//PFS is a dialog box that pops up after can set various properties of the paragraph format, paragraph format stored in PFS. M_paraformat, 
//PFS definition: static CParaformatSetup PFS;//CParaFormatSetup for custom dialog box class, inheritance CDialogEx
//dv for custom classes (C * * * * * * * * * * * * View) of the object, inherit the CView m_ctrlEdit for rich text box, 2.0
Dv - & gt; M_ctrlEdit - & gt; SetFocus ();
Dv - & gt; M_ctrlEdit - & gt; SetSel (l, r);//selected, make sure [l, r] interval length is not zero and not overrun
int a=100;
while (! Dv - & gt; M_ctrlEdit - & gt; SendMessage (EM_SETPARAFORMAT, 0, (LPARAM) & amp; (PFS. M_paraformat) & amp; & (a));//keep trying
//dv - & gt; M_ctrlEdit - & gt; SetParaFormat (PFS. M_paraformat);
}

Why to select a range, SendMessage or return zero forever?  urgent please!! Online etc.!!!!!!

CodePudding user response:

EM_SETCHARFORMAT documentation have been explained,
WParam
Character formatting that applies to the control. If this parameter is zero, the default character format is set.
Try SCF_SELECTION



CodePudding user response:

Oh, thank you, but I said is ParaFormat

CodePudding user response:

No one yet?

CodePudding user response:

LParam
Pointer to a CHARFORMAT structure specifying the character formatting to use. Only the formatting attributes specified by the dwMask member are changed.
A 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 2.
The szFaceName and bCharSet members may be overruled The when invalid for characters, for example: Arial on kanji characters.

CodePudding user response:

 
CHARFORMAT cf;

//Modify the selection format so that the selected text is
//displayed in bold and not striked out.
Cf. CbSize=sizeof (cf);
Cf. DwMask=CFM_STRIKEOUT | CFM_BOLD;
Cf. DwEffects=CFE_BOLD;
M_myRichEditCtrl. SetSelectionCharFormat (cf);

//Verify the Settings are what is expected.
M_myRichEditCtrl. GetSelectionCharFormat (cf);
ASSERT ((cf. DwMask& (CFM_STRIKEOUT | CFM_BOLD))==
(CFM_STRIKEOUT | CFM_BOLD));
ASSERT ((cf. DwEffects& (CFE_STRIKEOUT | CFE_BOLD))==CFE_BOLD);



  • Related