void ColorText(int min, int max, COLORREF color) {
CHARFORMAT cf;
cf.cbSize = sizeof(CHARFORMAT);
cf.dwMask = CFM_COLOR | CFM_UNDERLINE | CFM_BOLD;
cf.dwEffects = (unsigned long)~(CFE_AUTOCOLOR | CFE_UNDERLINE | CFE_BOLD);
cf.crTextColor = color;
SendMessage(hWndEdit, EM_SETSEL, (WPARAM)(int)min, (LPARAM)(int)max);
SendMessage(hWndEdit, EM_SETCHARFORMAT, (WPARAM)(UINT)SCF_SELECTION, (LPARAM)&cf);
}