Print Page | Close Window

WM_DESTROY of subclassed ActiveX control

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=4637
Printed Date: 07 July 2025 at 12:38am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: WM_DESTROY of subclassed ActiveX control
Posted By: mgampi
Subject: WM_DESTROY of subclassed ActiveX control
Date Posted: 21 July 2006 at 11:15am
Hi;
 
After ugrading from toolkit 4.1 to toolkit 10.1 or 10.2 the WM_DESTROY message handler of subclassed ActiveX controls is no longer called.
To reproduce create a MDI application with toolkit wizard (VC++ .NET 2003) and insert a ActiveX control as a member of the CView derived class of the MDI child window.
 
In OnCreate() handler of the view create and subclass the ActiveX control. Subclassing is necessary to receive and handle WM_xxx messages within the CWnd derived wrapper class of the control.

 

// COCXTestView message handlers

int COCXTestView::OnCreate(LPCREATESTRUCT lpcs)

{

if (CView::OnCreate(lpcs)!=0)

return -1;

VERIFY(_OCXControl.Create(0,0, WS_VISIBLE|WS_CHILD, CRect(0,0,0,0), this, 1));

HWND hWnd=_OCXControl.Detach();

VERIFY_OCXControl.SubclassWindow(hWnd));

return 0;

}

 
Insert a WM_DESTROY message handler into the wrapper class of the ActiveX control and for testing purposes also a WM_SIZE handler (to asure that WM_xxx messages are routet through the message map of the CWnd wrapper class.
 
When compiling and linking with Toolkit 4.1 the WM_DESTROY message of the wrapper class gets called but when linking to Toolkit 10.x it never gets called.
 
Since we have to cleanup in this handler, we need the OnDestroy() mechanism.
 
Any Ideas whats wrong and how to fix this.
 
Martin



Replies:
Posted By: Oleg
Date Posted: 21 July 2006 at 2:44pm
Hello,
I don't think toolkit can do it. Check your code.
 


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: mgampi
Date Posted: 21 July 2006 at 4:12pm

Hello;

My first thought also was that it has nothing to do with the toolkit. This resulted in a several weeks lasting conversation with Microsoft. At least I built two test applications - one with, one w/o toolkit integration. The toolkit version shows this behaviour. The plain MFC version is calling the handler.

So at the moment I believe it has something to do with your installed message hooks.

To reproduce it, you only have to create a simple MDI application and extend it with one ActiveX control member within the CView derived MDI client window view. To simplify the subclassing and message handling I derived from the CWnd control wrapper class and only inserted two message handler into this class - one for WM_SIZE and one for WM_DESTROY. OnSize is called while OnDestroy not

Thats all ...

Martin




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net