public void getForegroundWindow() { var foreGroundWindow = GetForegroundWindow(); if (foreGroundWindow == IntPtr.Zero) { Thread.Sleep(100); //var topWindow = GetTopWindow(IntPtr.Zero); var topWindow = WindowsWrapper.GetForegroundWindow(); var win = new WindowInfo(topWindow); Logger.Alert($"Can't find the foreground window retry {win.ProcessName}-{win.Title}"); } }
public void scanAllWindows() { try { this.timer.Stop(); WindowsWrapper windows = new WindowsWrapper(); windows.changeWindowOnTopSetting("outlook", "Reminder", this.showNotification); windows.changeWindowOnTopSetting("notepad", "test1234567.txt", this.showNotification); } catch (Exception ex) { Logger.Error($"{ex}"); } finally { this.timer.Start(); } }