We have been using the InfoPath Form Control successfully on Windows XP and Vista 32-bit machines quite a bit. But when we run the same application on a 64-bit machine, it crashes at the end of the control initialization when the ActiveX control attempts to create the InfoPath instance.
I downloaded the Microsoft InfoPath Form Control sample application (InfoPath2007UsingIOLECommands_RTM) here: http://www.microsoft.com/downloads/details.aspx?FamilyId=F65C20DF-ADC2-446A-8FBC-D7C5ED5DD83F&displaylang=en. The Microsoft sample app crashes in exactly the same place with the same error. But InfoPath itself (the application) runs fine in the same context.
What's causing the InfoPath Form Control to crash on a 64-bit platform?
System.Runtime.InteropServices.COMException was unhandled
Message="Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))"
Source="System.Windows.Forms"
ErrorCode=-2147221164
StackTrace:
at System.Windows.Forms.UnsafeNativeMethods.CoCreateInstance(Guid& clsid, Object punkOuter, Int32 context, Guid& iid)
at System.Windows.Forms.AxHost.CreateWithoutLicense(Guid clsid)
at System.Windows.Forms.AxHost.CreateWithLicense(String license, Guid clsid)
at System.Windows.Forms.AxHost.CreateInstanceCore(Guid clsid)
at System.Windows.Forms.AxHost.CreateInstance()
at System.Windows.Forms.AxHost.GetOcxCreate()
at System.Windows.Forms.AxHost.TransitionUpTo(Int32 state)
at System.Windows.Forms.AxHost.CreateHandle()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.AxHost.EndInit()
at HostedApplication.MainForm.InitializeComponent() in C:\Projects\Infopath2007\InfoPath2007UsingIOLECommands_RTM\HostedApplication\MainForm.designer.cs:line 1440
at HostedApplication.MainForm..ctor(String[] args) in C:\Projects\Infopath2007\InfoPath2007UsingIOLECommands_RTM\HostedApplication\MainForm.cs:line 64
at HostedApplication.Program.Main(String[] args) in C:\Projects\Infopath2007\InfoPath2007UsingIOLECommands_RTM\HostedApplication\Program.cs:line 17
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: