case WM_CTLCOLORSTATIC: // Color message received { SetBkMode((HDC)wParam, TRANSPARENT); // set the mode to transparent if ((HWND)lParam == GetDlgItem(hWnd, IDC_STATUS_IDLE)) // if the handle is IDC_STATUS_IDLE { SetTextColor((HDC)wParam, RGB(0, 0, 255)); return (LRESULT)(HBRUSH)GetStockObject(LTGRAY_BRUSH); // return the background color } else if ((HWND)lParam == GetDlgItem(hWnd, IDC_STATUS_SNIFFING)) { SetTextColor((HDC)wParam, RGB(50, 255, 50)); return (LRESULT)(HBRUSH)GetStockObject(LTGRAY_BRUSH); } else if ((HWND)lParam == hGroupBox) { return (LRESULT)(HBRUSH)GetStockObject(LTGRAY_BRUSH); } SetBkMode((HDC)wParam, OPAQUE); // reset the mode } break;