I am developing an extension for an existing application through COM.
The current application extension interface allows you to create custom property windows and use them inside this application.
Now I use .NET for this purpose and have weird problems:
extensionForm = new Form(); extensionForm.SetBounds(0, 0, 100, 100); extensionForm.Controls.Add(new Button()); ExApplAPI.AddCustomPropertyWindow(extensionForm.Handle.ToInt32(), "Ololo");
As you can see below, the property sheets actually expand, but after that something strange happens.

Basically, if I go to the Ololo tab and then return to any of the three tabs ( Attributes , Drawing or Services ), the application freezes. I also know that freezing occurs inside some unmanaged block of code.
Another interesting fact is that if I do not write extensionForm.Controls.Add(new Button()) (with or without Suspend / Resume Layout calls), everything works fine. So, if a newly built form has no controls (buttons or any other) on it, it does not freeze.
Here is the Spy++ log in the Ololo window right before the freeze (the last message is WM_CTLCOLORBTN , immediately after that the application freezes):

Putting it all together:
- Freezing occurs only if I switch from
Ololo to another tab and then switch back to the Ololo tab. - Freezing occurs only if the integrated form has at least one control; forms without controls do not freeze.
- Currently, the application does not manage any managed code and does not waste CPU time.
So - any ideas / similar problems that / etc have been resolved to help me in this case?
Yippie-ki-yay
source share