Running and developing using VS2008 SP1 on Win7 64 bit.
I have created a windows form into which I have embedded an activeX control (which we have also written). The OCX has been compiled in VS2008 using a Win32 configuration.
My app fails with a "class not registered" error. There are a few puzzling things
- The code doesn't fail the first time the OCX is instantiated
- The OCX has been manually registered successfully using regsvr32
- I thought I might be the victim of the down-system bug (http://support.microsoft.com/kb/2517589) but this didn't help
My simple app fails in the following code at the location shown:
private void InitializeComponent()
{
this.axChem3DCtl1 = new AxChem3DControl13.AxChem3DCtl(); <--- WORKS
((System.ComponentModel.ISupportInitialize)(this.axChem3DCtl1)).BeginInit(); <--- WORKS
this.SuspendLayout();
//
// axChem3DCtl1
//
this.axChem3DCtl1.Enabled = true;
this.axChem3DCtl1.Location = new System.Drawing.Point(110, 86);
this.axChem3DCtl1.Name = "axChem3DCtl1";
this.axChem3DCtl1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axChem3DCtl1.OcxState")));
this.axChem3DCtl1.Size = new System.Drawing.Size(617, 471);
this.axChem3DCtl1.TabIndex = 0;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(777, 605);
this.Controls.Add(this.axChem3DCtl1);
this.Name = "Form1";
this.Text = "Form1";
((System.ComponentModel.ISupportInitialize)(this.axChem3DCtl1)).EndInit(); <--- FAILS
this.ResumeLayout(false);
}
Exception raised:
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 OCXTest.Form1.InitializeComponent() in C:\Users\asmellie.CAMSOFT\Desktop\OCXTest\Form1.Designer.cs:line 53 at OCXTest.Form1..ctor() in C:\Users\asmellie.CAMSOFT\Desktop\OCXTest\Form1.cs:line 16 at OCXTest.Program.Main() in C:\Users\asmellie.CAMSOFT\Desktop\OCXTest\Program.cs:line 18 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:
Do you have any hints as to how I can go about debugging this?