Я играю с элементом управления Microsoft Outlook View, пытаясь понять его возможности, но я не захожу слишком далеко. Он обнаруживается во время разработки, но во время выполнения просто выдает исключение "E_CLASSNOTREG". Как мне узнать, на какой класс он жалуется?
Я только что создал проект winform, добавил элемент управления на панель инструментов и перетащил его в форму. Я вижу свой внешний почтовый ящик во время разработки. Добавляет следующий код:
/// <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 ().
Кроме того, другая странная вещь заключается в том, что каждый раз, когда я нажимаю на элемент управления в конструкторе, Visual Studio зависает на время, иногда на 30 секунд, в других случаях мне приходится убивать задачу Outlook, чтобы заставить VS ответить.
Я использую VS 2008 с последними исправлениями / SP, в Windows 7 x64, и у меня Office 2007 со всеми последними исправлениями и пакетами обновлений.
Почему это работает для меня во время разработки, но не работает во время выполнения? И как я могу узнать, что он ищет, который не зарегистрирован?