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 ?
ramakris100Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mandhjoCommented:
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.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.