Example #1
0
 private IntPtr FindFirstWindowLike(ExcludedWindow Window)
 {
     IntPtr[] Windows = WindowsTaskManager.GetWindowHandles();
     foreach (IntPtr Handle in Windows)
     {
         if (WindowsTaskManager.GetWindowClass(Handle) == Window.ClassName &&
             System.IO.Path.GetFileName(WindowsTaskManager.GetExecutableName(Handle)).ToLower() == Window.ProcessName.ToLower())
         {
             return(Handle);
         }
     }
     return(IntPtr.Zero);
 }
Example #2
0
        /// <summary>
        /// Adds a window class name to the exclusion list
        /// </summary>
        public void IgnoreWindow()
        {
            // create the new excluded window
            ExcludedWindow me = new ExcludedWindow(WindowsTaskManager.GetWindowClass(Handle), System.IO.Path.GetFileName(WindowsTaskManager.GetExecutableName(Handle)));

            //System.Diagnostics.Debug.WriteLine("ignoring "+me.ClassName+" from "+me.ProcessName);

            // load the custom list
            ExcludedWindow[] CustomExcludeList = WindowsTaskManager.LoadExcludedClassWindows(Orbit.Configuration.ConfigurationInfo.LocationsConfig.GetExcludedTasksFilePath());

            if (CustomExcludeList == null)
            {
                ExcludedWindow[] NewExcludedList = new ExcludedWindow[1];
                NewExcludedList[0] = me;
                WindowsTaskManager.SaveExcludedClassWindows(Orbit.Configuration.ConfigurationInfo.LocationsConfig.GetExcludedTasksFilePath(), NewExcludedList);
                return;
            }

            // set our new list
            ExcludedWindow[] ExcludeList = new ExcludedWindow[CustomExcludeList.Length + 1];
            // set our mandatory excluded tasks

            // add our new class
            ExcludeList[0] = me;

            // copy our custom exclusion list
            int i = 0;

            while (i < CustomExcludeList.Length)
            {
                ExcludeList[i + 1] = CustomExcludeList[i];
                i++;
            }

            WindowsTaskManager.SaveExcludedClassWindows(Orbit.Configuration.ConfigurationInfo.LocationsConfig.GetExcludedTasksFilePath(), ExcludeList);
        }