Detaching a CWnd from Its HWND
The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.
The latest version of this topic can be found at Detaching a CWnd from Its HWND.
If you need to circumvent the object-HWND
relationship, MFC provides another CWnd
member function, Detach, which disconnects the C++ window object from the Windows window. This prevents the destructor from destroying the Windows window when the object is destroyed.