Ho appena sviluppato un controllo ActiveX molto semplice (utilizzando la procedura guidata VS.NET, non cambia nemmeno una linea) e lo ho compilato. Dopo aver eseguito "regsvr32 ax1.ocx", ho creato un nuovo progetto C# WinFrom e ho trascinato il controllo ActiveX nel modulo. Poi ho costruire ed eseguirlo, l'errore dice:incorporando un semplice controllo ActiveX ottenuto errore di classe non registrato
Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))
all'interno della linea:
((System.ComponentModel.ISupportInitialize)(this.axax11)).EndInit();
L'intera funzione è:
private void InitializeComponent()
{
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.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(284, 262);
this.Controls.Add(this.axax11);
this.Name = "Form1";
this.Text = "Form1";
((System.ComponentModel.ISupportInitialize)(this.axax11)).EndInit();
this.ResumeLayout(false);
}
A proposito, corro a 64 bit Windows 7 Aggiornamento –
: se annullo la riga di EndInit() (che è la linea che causa l'eccezione), non c'è alcuna eccezione. Non so perché. –