I am attempting to change the text and background colors of a CStatic and simmilar MFC controls. After looking into this problem, I've come accross afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
but when I try to add this function to the message map is Visual Studio 2005, I get errors complaining about the wrong function definition. The only way I seem to be able to compile is by using
LRESULT OnCtlColor(WPARAM wParam, LPARAM lParam); instead of the above.
However, when I debug this code, the wParam provided is 0 and the lparam contains a large value. I can't find any documentation on this function, or what the parameters mean, and I'd like to know why I can't use the HBRUSH function definition in my program since its clearly documented all over the place.
My most recent attempt at this look like
LRESULT CGeoFlowDlg::OnCtlColor(WPARAM wParam, LPARAM lParam)
MyCDC = GetDC();
MyHDC = MyCDC->GetSafeHdc();
SetTextColor(MyHDC, RGB(0, 128, 0));
SetBkColor(MyHDC, RGB(0, 0, 255));
return (LRESULT)m_hDialogBrush; //brush was created at start of application and is set to dark grey
I put the above together from various examples in hopes of getting something to work, but no joy.