Note that there are some explanatory texts on larger screens.

plurals
  1. POC# add-in for application (via COM) freezes when a Control is added to the form?
    text
    copied!<p>I am developing an extension for existing application via <code>COM.</code></p> <p>Current interface of the application to extend allows <strong>to create custom property windows</strong> and use them inside that application.</p> <hr> <p><em>Now, I am using <code>.NET</code> for that purpose and have strange problems:</em></p> <pre><code> extensionForm = new Form(); extensionForm.SetBounds(0, 0, 100, 100); extensionForm.Controls.Add(new Button()); ExApplAPI.AddCustomPropertyWindow(extensionForm.Handle.ToInt32(), "Ololo"); </code></pre> <p>As you can see below, the property sheets <em>actually get extended</em>, but after that something strange starts to happen.</p> <p><img src="https://i.stack.imgur.com/Cntf2.png" alt="enter image description here"></p> <p>Basically, if I switch to <code>Ololo</code> tab, then back to any of other 3 tabs (<code>Attributes</code>, <code>Drawing</code> or <code>Services</code>), <strong>the application freezes.</strong> I also know that the freeze happens inside of some unmanaged code block.</p> <hr> <p>Another interesting fact here is that if I don't write the <code>extensionForm.Controls.Add(new Button())</code> <em>(with or without the Suspend / Resume Layout calls)</em>, <strong>everything works fine.</strong> So, if the recently constructed form has no controls (buttons or any other) on it, <em>it doesn't freeze.</em></p> <p>Here is a <code>Spy++</code> log on the <code>Ololo</code> window right before the freeze (last message is the <code>WM_CTLCOLORBTN</code>, right after that the application became frozen):</p> <p><img src="https://i.stack.imgur.com/NIDSi.png" alt="enter image description here"></p> <hr> <h2>Combining everything together:</h2> <ul> <li>Freezing happens only if I switch from <code>Ololo</code> to some other tab and then switch to the <code>Ololo</code> tab again.</li> <li>Freezing only happens if the integrated form has at least <strong>one control on it,</strong> forms without controls don't freeze.</li> <li>Application is not running any managed code at the moment and is not spending any CPU time.</li> </ul> <p><strong>So - any ideas / similiar problems solved / etc to help me in this case?</strong></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload