Misleading Error: "Parent class code is read only" (Visual Studio.NET)
I just had a strange error message from Visual Studio.NET when attempting to add a handler for
WM_DESTROY to a C++
dialog class. It said:
Add/Remove of the function is impossible because the parent class code is read only
Odd. There’s nothing read-only about any of this stuff.
It turns out that I’d previously had an
OnDestroy function in that class, and (somehow) the
had been left in the message map. This apparently confuses Visual Studio.
Just remove the old
ON_WM_DESTROY() line, and it’s happy to add a new one.