Recently in the use of MFC to develop software meets a very confused problem, software USES CRichEdit control that is used to display the log color, I have also successfully used the control, The software on some colleagues computer can run normally, also can display the color normal font, but on individual colleagues computer can not run normally, and we use computer system are win10, development environment, also on no development environment of computer software can run normally, I use the development environment is Visual Studio 2008. RichEdit the add library I also loaded, the software after the log area shows part of collapse, through the breakpoints view, is a function of the RichEdit GetWindowTextW () function is a problem, prompt access conflict, but the content of the show before certainly also calls the function, then also no problem, I don't know what is causing this kind of phenomenon,
CodePudding user response:
Direct operation in this thread?
CodePudding user response:
For, is in the child thread operation, the function as follows, but the software works on some computers, not on some computer, don't know how this Void IMEICHECKDlg: : AddLogString (cstrings strLog, a COLORREF color) { Cstrings log=CurrentTime (); StrLog +=_T (" \ r \ n ");
Int nOldLines=0; Int nNewLines=0; Int nScroll=0; Long nInsertionPoint=0; CHARFORMAT cf; NOldLines=m_richEdit. GetLineCount (); Cf. CbSize=sizeof (CHARFORMAT); Cf. DwMask=CFM_COLOR; Cf. The dwEffects=0; Cf. CrTextColor=RGB (0, 0); NInsertionPoint=m_richEdit. GetWindowTextLengthW (); NInsertionPoint=1; M_richEdit. SetSel (nInsertionPoint, 1); M_richEdit. SetSelectionCharFormat (cf); M_richEdit. ReplaceSel (log);