私はMicrosoftOutlookViewコントロールで遊んでいて、その機能を理解しようとしていますが、それほど遠くはありません。設計時に表示されますが、実行時には「E_CLASSNOTREG」例外が発生します。不平を言っているクラスを見つけるにはどうすればよいですか?
WinFormプロジェクトを作成し、ツールボックスにコントロールを追加して、フォームにドラッグしました。設計時にOutlookの受信トレイが表示されます。次のコードを追加します。
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
this.axViewCtl1 = new AxMicrosoft.Office.Interop.OutlookViewCtl.AxViewCtl();
((System.ComponentModel.ISupportInitialize)(this.axViewCtl1)).BeginInit();
this.SuspendLayout();
//
// axViewCtl1
//
this.axViewCtl1.Enabled = true;
this.axViewCtl1.Location = new System.Drawing.Point(384, 184);
this.axViewCtl1.Name = "axViewCtl1";
this.axViewCtl1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axViewCtl1.OcxState")));
this.axViewCtl1.Size = new System.Drawing.Size(192, 192);
this.axViewCtl1.TabIndex = 0;
//
// Form1
//
this.ClientSize = new System.Drawing.Size(1093, 633);
this.Controls.Add(this.axViewCtl1);
this.Name = "Form1";
((System.ComponentModel.ISupportInitialize)(this.axViewCtl1)).EndInit();
this.ResumeLayout(false);
}
それから私はそれを実行し、それは私に次のように死にます:
System.Runtime.InteropServices.COMException occurred
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 Sample.OutlookForm.Form1.InitializeComponent() in D:\source\tests\OutlookView\Sample.OutlookForm\Form1.Designer.cs:line 50
InnerException:
...例外はEndInit()です。
また、もう1つの奇妙な点は、デザイナーのコントロールをクリックするたびに、ビジュアルスタジオが一定期間フリーズすることです。場合によっては30秒ほどで、VSを応答させるためにOutlookタスクを強制終了する必要があります。
Windows 7x64で最新のパッチ/SPを使用してVS2008を実行しており、すべての最新のパッチとサービスパックがインストールされたOffice2007を使用しています。
なぜこれは設計時には機能するのに、実行時には失敗するのでしょうか。そして、登録されていないものを探しているものをどのように見つけることができますか?