I need to dynamically create and persist the state of ActiveX controls. The Visual Studio designer can do this at design time, but I need to be able to do it at run time. I need some pointers on how to dynamically load a control into an AxHost wrapper and using the AxHost wrapper to serialize the OCXState of the wrapped control. Any assistance would be most appreciated.

10 Years
Discussion Span
Last Post by mjuras

Here is a little more detail on what I am trying to do:

I am writing a tool to translate VB6 to .NET. I want to transform an arbitrary block of property bag data for an ActiveX control (in an FRM/CTL file) to a well-formed and valid block of OCXState data in a resx file?

What are the rules or conventions governing how VB6 and a given ActiveX control collaborate to write/read the FRM/CTL files?

Is it possible to implement a general solution to this problem?

The conceptual design of what I want to do is as follows:

1) interpret the Ax control's property bag data in the FRM file (possibly with the help of the original control – how?),

2) instantiate an AxHost wrapped instance of the ActiveX control,

3) initialize the instance with the data from the property bag

3) use AxHost methods to persist the OCXState data to a Resx file.

Problem is, sometimes, I cannot get passed the first step. Sometimes the property bag contains array notation for repeating elements; sometimes there are numbers appended to the ends of members; sometimes the property bag contains entries (e.g. NumItems) that to not correspond to any member in the control interface. There does not seem to be any rules.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.