das RichEditCtrl mag mich nicht
-
vermute ich so langsam #grr
void CShowLog::FormatContent() { FINDTEXTEX ft; ft.chrg.cpMin = 0; ft.chrg.cpMax = -1; ft.lpstrText = ":"; long n = m_Output.FindText(FR_MATCHCASE|FR_WHOLEWORD, &ft); if(n != -1) m_Output.SetSel(ft.chrgText); }so aus der MSDN entnommen - aber das FindText returniert immer -1 aber der string ":" kommt definitiv vor, sogar mehrmals - was solln der scheiss #grr
-
1. Lass mal FR_WHOLEWORD weg. : ist ein Trennzeichen und ist normalerweise nicht Bestandteil eines Wortes!
2. Du hast das gelesen?
FR_DOWN
Microsoft Rich Edit 2.0 and later: If set, the search is from the end of the current selection to the end of the document. If not set, the search is from the end of the current selection to the beginning of the document.
Rich Edit 1.0: The FR_DOWN flag is ignored. The search is always from the end of the current selection to the end of the document.Wo ist die aktuele Selektion?
-
keine ahnung wo die ist - das DOWN hab ich mitlerweile schon drinne steht, da ist dann nur das problem das sich das programm in einer dauerschleife verfaengt
ich glaub ich muss zuerst SetSel() an die erste position machen - werd ich probieren sobald ich zeit hab
ich vermute naemlich das die selection am ende des dokumentes ist
-
habs hinbekommen - indem ich einfach die schleife abbrechen lass sobald er wieder von vorn anfaengt
void CShowLog::SingleFormat(CString csSearchFor, COLORREF TextColor, DWORD Effect) { FINDTEXTEX ft; CHARFORMAT2 cf; ft.chrg.cpMin = 0; ft.chrg.cpMax = -1; cf.dwMask = CFM_BOLD|CFM_ITALIC|CFM_COLOR; ft.lpstrText = csSearchFor; cf.dwEffects = Effect; cf.crTextColor = TextColor; long n = 0; int i=0; do { n = m_Output.FindText(FR_DOWN|FR_MATCHCASE, &ft); if(n>i) i = n; else break; ft.chrg.cpMin = (n+1); if(n != -1) { m_Output.SetSel(ft.chrgText); m_Output.SetSelectionCharFormat(cf); } }while(n != -1); }brauch ich dann immer nur ganz simpel aufrufen {=