troubleshooting Question

ActiveX Control Releasing Resources OnClose

Avatar of viswanathat
viswanathat asked on
Visual Basic Classic
2 Comments1 Solution381 ViewsLast Modified:
Dear All,

I am writing a generic ActiveX control container, in MFC VC6 to hold the controls designed through VB6.

Here I am dynamically creating the controls at RunTime through CWnd::CreateControl() function. At this stage memory and gdi objects of the container is increasing. It is ok due to the resources in activex are created by now.

Even though I call DestroyWindow and deleting the Control window pointer on Close of the Container page, The Memory allotted and GDI Objects in Task manager are not reducing.

So Frequent opening of saved MDI pages containing ActiveX controls is causing a huge memory leak.

The controls are simple and with bitmaps and shapes.

If I use object = Nothing for the bitmaps and shapes (OnTerminate) the GDI and memory usage reduces by 30 percent.

Where could be the actual  problem.. in container or control side? Any more cleanup activity is to be done in activex controls?

Viswanath AT


Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros