Friday, 15 July 2011

c# - embedding a simple ActiveX control got Class not Registered error -


I have just developed a very simple ActiveX control (using a VSNet wizard, also a line) Not changed), and compiled it. After running "Regsvr32 ax1.ocx", I have created a new C # WinFrom project and drag the ActiveX control into the form. Then I create and run it, the error says:

  registered Class (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))  

In this line:

  ((System.ComponentModel.ISupportInitialize) (this.axax11)) . EndInit ();  

The entire function is:

  Private Zero initial element () {System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager (typeof (Form1) ); This.axax11 = New Axax1Lib.Axax1 (); ((System.ComponentModel.ISupportInitialize) (this.axax11)) BeginInit () .; This.SuspendLayout (); // // axax11 // this.axax11.Enabled = true; This.axax11.Location = new System.Drawing.Point (103, 90); This.axax11.Name = "axax11"; This.axax11.OcxState = ((System.Windows.Forms.AxHost.State) (resources.GetObject ("axax11.OcxState"))); This.axax11.Size = New system Drawing Size (100, 50); This.axax11.TabIndex = 0; // // form1 // this. Auto Scalements = New System. Drawing. Size F (6f, 13f); This.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; This.ClientSize = New system Drawing. Size (284, 262); This.Controls.Add (this.axax11); This.Name = "Form 1"; this. Text = "form1"; ((System.ComponentModel.ISupportInitialize) (this.axax11)) EndInit () .; This.ResumeLayout (wrong); }  

I think you wrote your anticox control in unmanaged C ++ code is. You will either need to create a 64-bit version of this control or you will need to force it to use the .NET program to run in 32-bit mode. The latter is fine soon, project + properties, build tab, platform target = x86.


No comments:

Post a Comment