【发布时间】:2014-12-19 18:50:34
【问题描述】:
我花了最后几个小时弄清楚如何订阅任何 Outlook 资源管理器的 BeforeMinimize 和 BeforeMaximize 事件,但失败了。到目前为止我做了什么:
public partial class ThisAddIn
{
Outlook.Explorer explorer;
Outlook.Application application;
Outlook.ExplorerEvents_10_BeforeMinimizeEventHandler beforeMinimizeEventHandler;
ThisAddin_Startup()
{
//... create custom Task pane
application = Globals.ThisAddIn.Application;
explorer = application.ActiveExplorer();
beforeMinimizeEventHandler = new Outlook.ExplorerEvents_10_BeforeMinimizeEventHandler(explorer_BeforeMinimize);
explorer.BeforeMinimize += beforeMinimizeEventHandler;
}
void explorer_BeforeMinimize(ref bool Cancel)
{
System.Windows.Forms.MessageBox.Show("BeforeMinimize");
Cancel = true;
}
}
该事件永远不会被触发。我还尝试了其他方法,例如将 explorer 转换为 Outlook.ExplorerEvents_10_Event 然后订阅。我还检查了只有一个 Explorer。但是,没有任何效果。
我做错什么了吗?感谢您的帮助。
【问题讨论】:
标签: c# .net events outlook vsto