lundi 2 mai 2016

runtime launch/ viewing an activeX control in c#

I'm developing a C# application that displays ActiveX controls provided by third party suppliers. These activeX controls are not known at compile time.
I have successfully launched COM libraries using the known Interface IObj.

Type tt = Type.GetTypeFromCLSID(clsid);  
myObj = (IObj)Activator.CreateInstance(tt);

Now I need the same for an activeX control - I know the CLSID/GUID. I'm using .Net4.0. Do I need to display it inside the WebBrower control? And if so How? The ActiveX does implement a known interface for initialization and termination.

Type typeAX = Type.GetTyplefromCLSID(clsid);  
activeX = (IOpenClose)Activator.CreateInstance(typeAx);  
myform.Controls.Add(activeX);  //Obviously not correct!  
myform.Show();  





Aucun commentaire:

Enregistrer un commentaire