[英]Event when user clicks to close message window
Is there a way to know when a user clicks to close the message window and before the "do you want to save changes" dialog shows up? 有没有办法知道用户何时单击以关闭消息窗口,以及在 “您要保存更改”对话框出现之前? I've registered to the Inspector.Close event but it fires only after the user has decided to save/discard the changes:
((InspectorEvents_10_Event)Inspector).Close += OnInspectorClose;
我已经注册了Inspector.Close事件,但是只有在用户决定保存/放弃更改后才会触发:
((InspectorEvents_10_Event)Inspector).Close += OnInspectorClose;
OK, so apparently I need to use the event from the mail item, not the inspector. 好的,因此显然我需要使用邮件项目中的事件,而不是检查器中的事件。 I need to register the handler inside eg.
我需要在里面注册处理程序。 the NewInspector handler:
NewInspector处理程序:
if (inspector.CurrentItem is MailItem)
{
MailItem item = inspector.CurrentItem as MailItem;
((ItemEvents_10_Event)item).Close += OnItemClose;
}
And then prepare the handler: 然后准备处理程序:
private void OnItemClose(ref bool cancel) //ItemEvents_10_CloseEventHandler
{
((ItemEvents_10_Event)_lastOpenedItem).Close -= OnItemClose;
_lastOpenedItem.Close(OlInspectorClose.olDiscard);
}
And this OnItemClose will execute before the Inspector's Close event fires ( ((InspectorEvents_10_Event)Inspector).Close
). 并且此OnItemClose将在检查器的Close事件触发之前执行(
((InspectorEvents_10_Event)Inspector).Close
)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.