TechyMaila wrote:I am using the Win32API. No MFC. Could you tell me which Windows message is equivalent to CWnd::PostNcDestroy?
WM_NCDESTROY is the last message for a window.
The MFC implementation goes like this. MFC does some clean up in
OnNcDestroy and then calls
PostNcDestroy. The default implementation does nothing. So you will have to implement something like this.
The default implementation of
CWnd::PostNcDestroy does nothing which is appropriate for window objects allocated on the stack frame or embedded in other objects. This is not appropriate for window objects that are designed to be allocated by themselves on the heap (not embedded in other C++ object).
Those classes that are designed to be allocated by themselves on the heap override the
PostNcDestroy member function to
perform a "delete this".
This statement will free any C++ memory associated with the C++ object. Even though the default
CWnd destructor calls
m_hWnd is non-
NULL, this does not lead to infinite recursion since the handle will be detached and
NULL during the cleanup phase.
Programming tips[^] My site[^]