Destroy ActiveX Control

I have created an ActiveX Control Container using MFC in VC 5.0. I launch ActiveX Controls created in MS VB 5.0. I use the CWnd's CreateControl call to create the OCX. While closing the OCX I call DestroyWindow. But the OCX still remains in memory. I found this when I tried to compile the VB OCX project. Once I closed the container application, I was able to compile the VB project. What should I do to destroy the OCX and unload it from memory ?
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

mandhjoConnect With a Mentor Commented:
DestroyWindow is defiitely the way to destroy an ActiveX control created by CreateWindow.

Did you also delete the pointer you allocated to store the ActiveX control (the CWnd pointer)?

If yes, take a look at the CoFreeUnusedLibraries api.  If you have properly deleted everything, this should cause the OCX to be unloaded by the EXE.
All Courses

From novice to tech pro — start learning today.