I am having problems with the fact that the placed window is correctly destroyed.
I have an HwndHost -derived class that I am showing in TabControl (although this probably doesn't matter). I try to destroy the hosted content when the tab closes (not when the closing window closes.)
Currently, I have code affecting myControlHost.Dispose() , which ensures that HwndHost.DestroyWindowCore is called immediately. The problem is that DestroyWindowCore does not actually destroy hosted HWND content!
I would think that this was enough to guarantee that the underlying CWnd application receives WM_CLOSE or something like that, but it does not seem to happen - Spy ++ only reports the registered message "HwndSubclass.DetachMessage", sent.
I read that you should not explicitly send your hosted window a WM_CLOSE to DestroyWindowCore , as this should happen automatically.
What is the right way to ensure that the hosted window is destroyed correctly when manually removing the HwndHost control?
source share