[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.interop

Dynamic loading of ActiveX controls

Stritch

3/21/2007 4:16:00 AM

We have an MDI application developed in VB6. Most of the application's
functionality is written as a collection of ActiveX controls (lets
call them modules) in several ocx libraries. These modules are
dynamically loaded (using Controls.Add) into a master control (lets
call it ctlExternal) which is sited on an instance of a VB MDI child
form.

We are porting this application to .Net (using C#) in stages. We are
at stage 1. The main exe is written in .net and it must host these
modules. There are > 100 of them and many of them are very complex, so
porting them all to .net must wait until stage 2+.

We have tried many approaches to this. Many approaches work on all our
development machines, but none of them work on any other machines. We
cannot figure out the difference. The dependencies appear to all be
present (the original VB version (which uses the same ActiveX control
modules) runs fine). Our approaches have been:

Approach 1: Host the ctlExternal ActiveX control on a .net form. The
ctlExternal control would dynamically load a module as it normally
does in VB.
Problem 1: Many modules contain Sheridan controls. In the .net main
exe, these Sheridan controls load in demo mode. They load correctly in
the VB main exe.
Problem 2: Modules load correctly, but when they attempt to initialise
themselves with current data, they produce one or more of the
following errors: "The object invoked has disconnected from its
clients.", "Failed to load control 'Xxxxx' from . Your version may be
outdated. Make sure you are using the version of the control that was
provided with your application."
Problem 3: Rich Text boxes raises error "The object invoked has
disconnected from its clients."

Approach 2: Create an exact copy of the ctlExternal control for every
module and add the module ActiveX control to its own private copy at
design time. Then load these controls dynamically into the .Net form
using reflection. (This is poor design but it won't be needed when the
conversion is complete.)
Problem 1: Modules load correctly, but when they attempt to initialise
themselves with current data, they produce one or more of the
following errors: "The object invoked has disconnected from its
clients.", "This item's control has been deleted", "Method '~' of
object '~' failed", Attempted to read or write protected memory"
Problem 2: Some of the module's constituent controls' events fail to
fire.

Approach 3: Dynamically load each module control directly into
the .net form using reflection. This requires an interop for each ocx.
Problem 1: Modules load correctly, but when they attempt to initialise
themselves with current data, they produce an error "Automation error.
Error in the Dll".

Clearly there is something different about the machines. I have
checked the dependencies on the target machine and they are >= the
versions on the dev machines.

We are using:
WinXP SP2 +updates
VS2005 (not SP1)
VB6.0, SP6