Hidden Toolstrips cause CFormView to crash

M

Mike

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
 
M

Mike

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top