Note that there are some explanatory texts on larger screens.

plurals
  1. POCOM App calling .NET form calling COM form, works when compiled but not in VB6 IDE
    primarykey
    data
    text
    <p>I have a legacy VB6 / COM application that we are migrating all of the code to .NET (VB.NET) via a .NET DLL. All new form development is being done in the .NET DLL. </p> <p>We use function pointers to call back to COM functions within .NET form:</p> <ol> <li>I create a delegate in .NET</li> <li>Set the delegate to the AddressOf the COM function at runtime (GetDelegateForFunctionPointer)</li> <li>Show the .NET Form</li> <li>Invoke the delegate</li> </ol> <p>COM App --> .NET Form --> COM function</p> <p>This works fine for functions. Where this breaks down is when I call a COM function that shows a form. </p> <p>COM App --> .NET Form --> COM function --> COM Form</p> <p>The COM function will execute and the form will show, but when executing in the VB6 IDE the COM form's logic does not execute. The controls are shown, but any click or form_load events are not executed. This is not an issue when the VB6 application is compiled.</p> <p>Another issue I've noticed is that the VB6 IDE "freezes" until the .NET form unloads. I can not stop the debugger, set breakpoints, or interact with IDE's menu. It is as if the VB6 IDE allows the .NET DLL to take complete control over the thread. I believe these two issues are related.</p> <p>EDIT: The .NET form is modal, which may be the reason for the IDE thread lock. I'm just wondering if there is a way around it. Also, I've looked at the InteropForms Toolkit. It does not solve my problem. Even setting their sample forms to modal causes the same IDE thread lock to occur. </p> <p>EDIT 2: My previous edit did allude to another workaround: Make the .NET form show as modeless when the host application is VB6.</p> <pre><code>If InStr(Process.GetCurrentProcess().ProcessName, "vb6", CompareMethod.Text) &gt; 0 Then frm.Show() Else frm.ShowDialog() frm.Dispose() End If </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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