Ejemplo n.º 1
0
    private void Update()
    {
        //----------------------------------------------
        if (_windowCheckTimers.expired)
        {
            _allWindowsCached.Clear();
            _windowCheckTimers.Restart();
            //foreach (Process p in Process.GetProcesses())
            //{
            //if (!p.HasExited)
            //{
            //    if (p.MainModule.FileName.Contains("chrome"))
            //    {
            //        print(p.MainModule.FileName + " : " + p.MainWindowTitle);
            //    }
            //}
            //if (!string.IsNullOrEmpty(p.MainWindowTitle))
            //{
            //_allWindowsCached.Add(p.MainWindowTitle);
            //}
            //}
            //IntPtr shellWindow = GetShellWindow();


            //_allWindowsCached.Clear();

            WinOsUtil.EnumWindows(allWindowIter, IntPtr.Zero);
        }
    }
Ejemplo n.º 2
0
    // Puts all windows existing associated with the processId in the bucket
    static void CollectProcessWindows(int processId, List <IntPtr> bucket)
    {
        _allWindowsCached.Clear();

        if (processId == 0)
        {
            return;
        }

        // look through all the windows
        WinOsUtil.EnumWindows(delegate(IntPtr hWnd, IntPtr lParam)
        {
            // add the handle to the bucket if it's associatd with the given process
            if (DoesWindowMatchProcessId(hWnd, processId))
            {
                if (!bucket.Contains(hWnd))
                {
                    bucket.Add(hWnd);
                }
            }
            return(true);
        }, IntPtr.Zero);
    }