I am getting this compiler error:
Error C2662:
CWnd::MessageBoxA: cannot convertthispointer fromconst CEditFieldtoCWnd &*
In the following const method:
bool CEditField::CanBeChanged() const
{
bool bCanBeChanged = true;
// ...
if (!bCanBeChanged)
{
MessageBox("This field is uneditable", "Cannot Edit Field");
}
return bCanBeChanged;
}
CEditField is derived from CDialog.
I am working around this by using the WinAPI MessageBox(this->m_hWnd, ...).
Why would CWnd::MessageBox be non-const?