Ejemplo n.º 1
0
        /// <summary>
        /// Gets all the running tasks as OrbitItems
        /// </summary>
        /// <param name="device">Direct3D Device to load resources to</param>
        /// <returns>An array of OrbitItems</returns>
        public static OrbitItem[] GetTasks(Device device)
        {
            ExcludedWindow[] ExclusionList = LoadExcludedClassWindows();
            IntPtr[]         TasksList     = WindowsTaskManager.GetWindowHandles(ExclusionList);
            if (TasksList == null)
            {
                return new OrbitItem[] { new EmptyItem(device) }
            }
            ;

            // actually catalog them
            OrbitItem[] ItemRegistry = new OrbitItem[TasksList.Length];

            int a = 0;

            foreach (IntPtr Handle in TasksList)
            {
                ItemRegistry[a] = new TaskItem(device, new WindowInformation(WindowsTaskManager.GetWindowText(Handle), Handle));

                if (ItemRegistry[a] != null)
                {
                    ItemRegistry[a].Parent = "Orbit";
                    ItemRegistry[a].Line   = 0;
                }
                a++;
            }

            return(ItemRegistry);
        }
Ejemplo n.º 2
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);
 }