tags:

views:

433

answers:

3

Hi all,

I'm trying to dynamically add an ActiveX control to my application, without having to place it on a form.

However, when I do place the ActiveX control using the Visual Studio designer, initialization code is generation which contains a statement for setting for OcxState of the ActiveX control.

When an ActiveX control is added to a form using the designer, it seems like that the OcxState is serialized into a resources file, which is later retrieved at the initialization of the form.

Now I want to set that OcxState dynamically in code, so I can create some kind of wrapper class for the ActiveX for in my class library.

Anyone knows how to dynamically set the OcxState of an ActiveX control?

Thanks in advance!

Mathieu

A: 

Hi, i working in the same problem, the solution i got by now is working with a Worker form, that is not show, but where i can load the ocx and wrapper all the events and methods of the ocx to the outside. In my library class i use the form like any other class instead of the ocx calls

Jesus Mogollon
Can you describe your solution?
Dour High Arch
+1  A: 

I had the same problem while I was working on a .NET project that requires an ActiveX control for data manipulation. I had to put the ActiveX control on a form, load it with the application and use it with a public property. Otherwise if I just create an instance of the control I loose some of the functionality.

The form does not require to be visible all the time but it provides a container where the ActiveX control can live.

A9S6
A: 

Worker form is good work around , thx Jesus Mogollon

ahmad