ATL::CWindowImpl provides an overrideable method
OnFinalMessage which can be used to delete an object.
OnFinalMessage will be called when a window is
destroyed and all messages are processed. However,
the implementation of CWindowImpl::WindowProc is not
correct, which can lead to a crash, especially in multi-
This is an ATL bug, and not a WTL one, but it is
included here for two reasons: because it directly
impacts WTL projects (for example, MDI projects use
OnFinalMessage), and because WTL might need to find a
way to fix this.
Submitted by Pavel Mosunov