Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Destroy ActiveX Control

Posted on 1999-07-02
Medium Priority
Last Modified: 2013-11-20
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 ?
Question by:ramakris100
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment

Accepted Solution

mandhjo earned 200 total points
ID: 1308688
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.

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question