Пример #1
0
        private bool EnumWindowsProc(IntPtr hwnd, IntPtr param)
        {
            if (!IsAltTabWindow(hwnd))
                return true;

            var sb = new StringBuilder(255);
            int nLength = WinApi.GetWindowText(hwnd, sb, sb.Capacity + 1);
            string title = sb.ToString();

            if(String.IsNullOrEmpty(title))
                return true;

            var processInfo = new TaskInfo {MainWindowHandle = hwnd, MainWindowTitle = title};

            if(RunFilters(processInfo))
                _taskList.Add(processInfo);

            return true;
        }
Пример #2
0
        // Refactor: Abstract this into Chain of Responsibility or something similar
        private bool RunFilters(TaskInfo taskInfo)
        {
            if(taskInfo.MainWindowTitle.Trim() == "Program Manager")
                return false;

            return true;
        }