private bool IsInterestingWindow(IntPtr handle) { if (handle == IntPtr.Zero) { return(false); } if (_settings?.InterestingWindows == null) { return(false); } if (!Win32NativeMethods.IsWindowVisible(handle)) { return(false); } var windowTitle = Win32NativeMethods.GetWindowText(handle) ?? ""; var windowClass = Win32NativeMethods.GetWindowClass(handle) ?? ""; if (Title.Equals(windowTitle)) { return(false); } return(_settings.InterestingWindows.Any(interestingWindow => interestingWindow.IsMatching(windowTitle, windowClass))); }