Found it:
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
InfoPath._Application3 iApplication = (InfoPath._Application3)this.Application;
events = (InfoPath.ApplicationEvents)iApplication.Events;
events.WindowActivate += new InfoPath._ApplicationEvents_WindowActivateEventHandler(events_WindowActivate);
}
void events_WindowActivate(InfoPath._XDocument pDocument, InfoPath.Window pWindow)
{
throw new NotImplementedException();
}