Outlook中没有应用程序退出事件?

And*_*rei 6 c# outlook outlook-object-model quit

我正在使用12.0 Interop库,这是Outlook 2007的默认值.我实际上的目标是将Outlook 2003到2010集成到一个注册到退出事件的代码示例.

即使文档说Outlook应用程序有一个应用程序Quit 事件,我也无法在Outlook.Application对象实现中找到它.

Visual Studio 2010似乎确定Quit为一种方法:

退出似乎是一种方法,而不是一个事件

题:

如何注册Outlook应用程序的Quit事件?(如果有一个,或者在应用程序退出时触发的任何事件)如果可能,请提供一些示例代码.

谢谢!

VMh*_*VMh 25

((Outlook.ApplicationEvents_11_Event)Application).Quit 
+= new Outlook.ApplicationEvents_11_QuitEventHandler(ThisAddIn_Quit);

void ThisAddIn_Quit()
{
   System.Windows.Forms.MessageBox.Show("bye bye problem, I found the solution!!");
}
Run Code Online (Sandbox Code Playgroud)

  • 的确如此。需要此功能是因为根据MSDN,Outlook 2007SP2,Outlook 2010及更高版本不再需要ThisAddin_Shutdown。[link](http://msdn.microsoft.com/zh-CN/library/ee720183%28v=office.14%29.aspx) (2认同)

Tig*_*ran 2

只是尝试给出一个解决方案:也许您可以获取Outlook 进程并监听Process.Exited事件。