I've tried to catch the EN_SelChange event, but it never triggers although I have added
rich->SetEventMask(rich->GetEventMask() | ENM_CHANGE | ENM_SELCHANGE);
in OnInitDialog fxn. So I tried to add the following code in my OnEraseBkgnd function.
BEdit *edit = (BEdit *)GetDlgItem(IDC_MAIN_EDIT1);
CRichEditCtrl *ctrl = &(edit->GetRichEditCtrl());
long s = 0 , e = 0;
ctrl->GetSel(s, e);
and the program crashed on GetSel function
I'm now figuring out one way to change the text highlight color when it get selected.