WM_DESTROY of subclassed ActiveX control |
Post Reply |
Author | |
mgampi
Senior Member Joined: 14 July 2003 Status: Offline Points: 1201 |
Post Options
Thanks(0)
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
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hello,
I don't think toolkit can do it. Check your code.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
mgampi
Senior Member Joined: 14 July 2003 Status: Offline Points: 1201 |
Post Options
Thanks(0)
|
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 |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |