Reputation: 421
Office Version: 2303 (Build 16227.20280)
Below is a very simple project. I subscribe to a few events, and write to the debugger.
I have some sample files that are guaranteed to display a ProtectedViewWindow, but the events still don't fire.
What am I missing?
using PowerPoint = Microsoft.Office.Interop.PowerPoint;
namespace PowerPointAddIn1
{
public partial class ThisAddIn
{
private PowerPoint.Application theApp;
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
theApp = this.Application;
theApp.ProtectedViewWindowActivate += TheApp_ProtectedViewWindowActivate;
theApp.ProtectedViewWindowOpen += TheApp_ProtectedViewWindowOpen;
theApp.ProtectedViewWindowBeforeEdit += TheApp_ProtectedViewWindowBeforeEdit;
}
private void TheApp_ProtectedViewWindowBeforeEdit(PowerPoint.ProtectedViewWindow ProtViewWindow, ref bool Cancel)
{
System.Diagnostics.Debug.WriteLine("TheApp_ProtectedViewWindowBeforeEdit");
}
private void TheApp_ProtectedViewWindowOpen(PowerPoint.ProtectedViewWindow ProtViewWindow)
{
System.Diagnostics.Debug.WriteLine("TheApp_ProtectedViewWindowOpen");
}
private void TheApp_ProtectedViewWindowActivate(PowerPoint.ProtectedViewWindow ProtViewWindow)
{
System.Diagnostics.Debug.WriteLine("TheApp_ProtectedViewWindowActivate");
}
private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
{
}
#region VSTO generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InternalStartup()
{
this.Startup += new System.EventHandler(ThisAddIn_Startup);
this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown);
}
#endregion
}
}
Upvotes: 0
Views: 45
Reputation: 421
[THIS IS NO LONGER AN ISSUE] It turns out that the alert being received was not a ProtectedViewWindow.
Will pursue new question in different thread.
Upvotes: 0