B
SO habs jetzt:
// function to add a text
void utilAppendTextToWindow(HWND hWnd, char *szText, COLORREF crTextColor)
{
// private
int tl;
CHARFORMAT cf;
tl = GetWindowTextLength(hWnd);
// add new text
SendMessage(hWnd, EM_SETSEL, tl, tl);
SendMessage(hWnd, EM_REPLACESEL, FALSE, (LPARAM)szText);
// fill struct
memset( &cf, 0, sizeof(CHARFORMAT) );
cf.cbSize = sizeof(CHARFORMAT);
cf.dwMask = CFM_COLOR;
cf.crTextColor = crTextColor;
// select last text inserted
tl = GetWindowTextLength(hWnd);
SetFocus(hWnd);
SendMessage(hWnd, EM_SETSEL, (WPARAM)(tl-strlen(szText)), (LPARAM)tl);
// set color
SendMessage(hWnd, EM_SETCHARFORMAT ,SCF_SELECTION, (LPARAM)&cf);
// set cusor to end of text
SendMessage(hWnd, EM_SCROLL, SB_PAGEDOWN, 0);
}
[ Dieser Beitrag wurde am 25.12.2002 um 17:33 Uhr von paranoiac.org editiert. ]