Destroying controls created by CWinFormControl
C / C++ / MFC
1
Posts
1
Posters
0
Views
1
Watching
-
I'm using CWinFormControl to create instances of .Net UserControls. CWinFormsControl m_control; m_control.CreateManagedControl( WS_CHILD | WS_VISIBLE, rect, this, IDC_HOSTCONTROL ); This works fine. The problem occurs when I try to destroy the control. I need a deterministic call to the 'MyControl' finalizer, so I wrote the following: m_control.DestroyWindow(); System::GC::Collect(); This code does not cause the Finalize\Dispose code to be called on 'MyControl'. In fact, 'MyControl' sticks around in memory until the MFC app closes. What am I doing wrong here? Thanks, Aaron