I want port a MFC project to the current available resources.
I develop with Microsoft Visual Studio Community.
In the older project the Windows SDK Version is 10.0.15063.0
in the new project the Windows SDK Version is 10.0.17763.0
the older project uses ComCtrl32.dll Version 5.82
the new project uses ComCtrl32.dll Version 6.10
After the update with SetWindowTextW(textp) the used CEdit control shows a black control rectangle
If I move the cursor over the control it looks as expected.
ValEdit.h :
class ValEdit : public CEdit
{
public:
ValEdit();
virtual ~ValEdit();
int ZeroMeansInactiv;
protected:
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
afx_msg void OnUpdate();
DECLARE_MESSAGE_MAP()
private:
COLORREF m_TextColor;
HBRUSH m_hBackgroundBrush;
HBRUSH m_hBackgrInactivBrush;
};
ValEdit.cpp :
ValEdit::ValEdit()
{
ZeroMeansInactiv = 1;
m_TextColor = Black;
m_hBackgroundBrush = CreateSolidBrush(RGB(255, 255, 255));
m_hBackgrInactivBrush = CreateSolidBrush(RGB(90, 90, 90));
}
ValEdit::~ValEdit()
{
}
BEGIN_MESSAGE_MAP(ValEdit, CEdit)
ON_WM_ERASEBKGND()
ON_CONTROL_REFLECT(EN_UPDATE, OnUpdate)
END_MESSAGE_MAP()
BOOL ValEdit::OnEraseBkgnd(CDC* pDC)
{
RECT rc;
this->GetClientRect(&rc);
SetMapMode(*pDC, MM_TEXT);
FillRect(*pDC, &rc, !!ZeroMeansInactiv ? m_hBackgroundBrush : m_hBackgrInactivBrush );
return TRUE;
}
void ValEdit::OnUpdate()
{
RedrawWindow();
}
Thank you for advice
Erhy