Static Text is located on the form, the text color needs to be changed periodically, the background remains the original, it has reached:
case WM_CTLCOLORSTATIC: { if( ((HWND)lParam)==GetDlgItem(hDlg, IDC_STATUS_DDE) ) { SetBkMode((HDC) wParam, TRANSPARENT); SetTextColor((HDC) wParam, RGB(0,0,255)); } return (INT_PTR)GetStockObject(NULL_PEN); }
As a result, the text IDC STATUS DDE changes color to blue, but on the rest of the Static Text, the background color has changed to another! Who is strong help to understand!
Changed the code as recommended by @mega
case WM_CTLCOLORSTATIC: if( ((HWND)lParam)==GetDlgItem(hDlg, IDC_STATUS_DDE) ) { SetBkMode((HDC) wParam, TRANSPARENT); SetTextColor((HDC) wParam, RGB(0,0,255)); return (INT_PTR)GetStockObject(NULL_BRUSH); } else return DefWindowProc(hDlg, message, wParam, lParam);
Earned almost as required, but with the next output in Static Text
SetDlgItemTextA (g_hwndMainForm, IDC_STATUS_DDE, szStatusDDE);
there is a superposition of one line to another, which I have not yet considered!?
NULL_BRUSH
. Those. if you returnNULL_BRUSH
, the component will not fill the background at all. And since there is no background, it means that it will never be updated, i.e. all that is drawn on it, then it will remain. Hence the result - all overlays are visible. - megaIDC_STATUS_DDE
remain unchanged, you do not need to return the handle at all, even if DefWindowProc does the same. - megaDefWindowProc
, and then change the text color, and then return whatDefWindowProc
returned. Or just return some system brush handle, for example:::GetSysColorBrush( COLOR_BTNFACE )
- mega