Article ID: 229904 - View products that this article applies to.
This article was previously published under Q229904
This article has been archived. It is offered "as is" and will no longer be updated.
The CAxWindow CreateControl() and AttachControl() functions may leak memory if not used correctly.
The following two techniques of creating ActiveX controls on composite controls (or any window supporting ATL containment) can result in memory leaks.
In both techniques, the calls to Create() results in the creation of a CAxHostWindow object. The call to CreateControl() or AttachControl() also creates another CAxHostWindow Object. Upon destruction, the CAxHostWindow object created by Create() is freed.
Use one of the techniques mentioned in article Q218442 to create ActiveX controls at run time.
For additional information, click the article number below to view the article in the Microsoft Knowledge Base:
(http://support.microsoft.com/kb/192560/EN-US/ )HOWTO: Adding ATL Control Containment Support to Any Window
(http://support.microsoft.com/kb/218442/EN-US/ )HOWTO: Programmatically Add ActiveX Controls to Composite Control
Article ID: 229904 - Last Review: February 21, 2014 - Revision: 3.0
Contact us for more help
Connect with Answer Desk for expert help.