[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.interop

Hidden Toolstrips cause CFormView to crash

MLM450

10/12/2007 1:20:00 PM

I am using CFormView and CWinFormsControl in C++ to show a C# control.
The control includes a toolstrip container and various toolstrips. If
all the toolstrips are hidden (visible = false) on any of the
container's panels, a mouse click will cause a stack overflow.

The problem is in the PreTranslateMessage() function of CFormView. It
calls _AfxNextControl. When that function tries to get the parent of
the hidden toolstrip, it gets null which throws it into an infinite
loop. If the toolstrip is visible, the correct parent is retrieved and
all works well.

Does anybody know how to fix this so the correct parent is returned?

Thanks,
Mike

1 Answer

MLM450

10/12/2007 5:25:00 PM

0

In case anyone else has this problem, it seems to be resolved by
removing the WM_EX_CONTROLPARENT style from the toolstrip controls.

If there is a better way to resolve it, or if someone knows any reason
why I would not want to remove that style, please let me know.

On Oct 12, 9:19 am, Mike <MLM...@hotmail.com> wrote:
> I am using CFormView and CWinFormsControl in C++ to show a C# control.
> The control includes a toolstrip container and various toolstrips. If
> all the toolstrips are hidden (visible = false) on any of the
> container's panels, a mouse click will cause a stack overflow.
>
> The problem is in the PreTranslateMessage() function of CFormView. It
> calls _AfxNextControl. When that function tries to get the parent of
> the hidden toolstrip, it gets null which throws it into an infinite
> loop. If the toolstrip is visible, the correct parent is retrieved and
> all works well.
>
> Does anybody know how to fix this so the correct parent is returned?
>
> Thanks,
> Mike