This documentation is archived and is not being maintained.

Create an ActiveX Control that can Bind to InfoPath Form Data

Office 2007

You can host ActiveX controls in forms. These controls can be preexisting (with some constraints) or can be written specifically for InfoPath.

Write an ActiveX control

As with other controls in InfoPath, ActiveX controls should support existing Component Object Model (COM) interfaces:

  • IDispatch
  • IPersistPropertyBag
  • IPersistStreamInit
  • IPropertyPage
  • IObjectSafety
  • IPropertyNotifySink
  • IViewObject
  • IOleObject
  • IOleInPlaceObject

In order for InfoPath to update properties in the Document Object Model (DOM) at the time they change in the control, the control should implement the following interfaces:

  • IConnectionPointContainer
  • IEnumConnectionPoints
  • IConnectionPoint
  • IEnumConnections

Two new COM interfaces have been added to provide tighter integration of controls:

  • IInfoPathControl
  • IInfoPathControlSite

For more information on these interfaces, see the Help for the InfoPath object model.

Add an ActiveX control to the InfoPath design environment

The Controls task pane allows you to use the Add Custom Control Wizard to add a custom control. With the wizard, you can:

  • Select an ActiveX control that has already been registered.
  • Specify a CAB to install the ActiveX control with a form.
  • Specify a binding property to bind to the XML.
  • Specify an enable or disable property, which can be useful, for example, when the XML is not present or when conditional formatting is used.
  • Specify data type binding.
Bb251031.vs_note(en-us,office.12).gif  Note
If you are developing an ActiveX control and have added it to the Controls task pane in InfoPath, you will not be able to rebuild the ActiveX control until InfoPath is closed.

Deploy an ActiveX control

To distribute an ActiveX control, you can write an installer that installs the control on the target computer and copies the InfoPath Control Template (ICT) file and the CAB file to the user's folder, Local Settings\Application Data\Microsoft\InfoPath\Controls. Note that if two or more developers are collaborating on developing forms that use ActiveX controls, each developer should have the controls added to the InfoPath design environment, or they will not be able to modify the properties of the controls from within InfoPath.