private static AutomationEventHandler GetOpenWindowHandler(int processId)
        {
            return((sender, e) =>
            {
                AutomationElement element = sender as AutomationElement;
                string processName = Process.GetProcessById(element.Current.ProcessId).ProcessName;
                if (element.Current.ProcessId != processId &&
                    processName != Constants.pptProcess)
                {
                    return;
                }
                IntPtr handle = new IntPtr(element.Current.NativeWindowHandle);
                string windowName = WindowUtil.GetWindowTitle(handle);
                if (windowName == "")
                {
                    Logger.Log("Titleless window in windowwatcher: " +
                               $"pID: {element.Current.ProcessId}\n" +
                               $"process name: {processName}\n" +
                               $"HWND: {handle}");
                    return;
                }
                lastOpenWindowName = windowName;

                WindowOpenTrigger resultTrigger = GetWindowTrigger(windowName);
                if (resultTrigger == null)
                {
                    WindowUtil.CloseWindow(handle);
                    //MessageBox.Show(windowName);
                    return;
                }
                resultTrigger.resultingWindow = handle;
                resultTrigger.Set();
            });
        }