Displaying non-modal forms via interop from COM DLLs

  • Thread starter Thread starter Oenone
  • Start date Start date
O

Oenone

I'm continuing work on getting my VB6 plug-ins to work within my VB.NET
application and am making reasonable progress.

I've just experienced an error that has me a bit worried though.

Many of my plugins use non-modal forms to present data to the user. They
typically open the form and then use it to display progress through whatever
operations they are performing, closing it once they have finished.

As soon as I try to use one of these through COM interop, I get the
following error message:

Non-modal forms cannot be displayed in this host application from an
ActiveX DLL, ActiveX Control, or Property Page

I have two immediate questions:

1. Why? I don't understand why this is a problem?

2. What on earth am I supposed to do about it? :) If I can't get this to
work then virtually all of my plug-in DLLs will break, which will be very
expensive to fix.

My thanks in advance,
 
Jared said:

Hi Jared,

Thanks for the link. I was initially unconvinced that this was relevant, but
the section describing the behaviour of modeless forms in some containers
does describe the problem I'm encountering.

However, this still doesn't explain (to me, anyway) why this is an issue
(particularly as the host in this case is a .NET application, not IE) or how
to work around it. The proposed solution of "don't open modeless windows"
isn't going to help me much. :-(

Regards,
 
I can't seem to find any explanation of why this behavior occurs.

The only work around I can think of that _might_ work is the following. Add
a callback to your plugin API that passes back a reference to your ActiveX
control. Then use your winform app to create a non modal dialog hosting
this control via AxHost.
 
Jared said:
I can't seem to find any explanation of why this behavior occurs.

Oh well :)
The only work around I can think of that _might_ work is the
following. Add a callback to your plugin API that passes back a
reference to your ActiveX control. Then use your winform app to
create a non modal dialog hosting this control via AxHost.

Thanks for the suggestion. I should clarify that it's a simple form I'm
trying to display, not an ActiveX control. It's a COM DLL with a normal form
within it, and I'm trying to display the form.

I'll have a think about retrieving instances of the form back into the .NET
app and see if there's anything I could do with it, though. It looks like
the possibility of me running the plug-in DLLs unchanged (as I had
originally planned) has more-or-less evaporated. :(
 
Back
Top