예제 #1
0
        protected bool LoadWindows()
        {
            HwndObject.CacheResetUsed();
            Process           proc     = GetProcessFirstVisible();
            List <HwndObject> hwndObjs = null;

            if (proc != null)
            {
                HwndObject hwndObject = HwndObject.GetInstance(proc.MainWindowHandle);
                hwndObjs = hwndObject.GetSiblings();
            }
            else
            {
                hwndObjs = HwndObject.GetWindows();
            }

            procCache.ResetUsed();
            bool    isChanged = false;
            AppData appData;

            foreach (var hwndObj in hwndObjs)
            {
                if (IsHwndSelectable(hwndObj))
                {
                    proc = procCache.Get(hwndObj.PID);
                    if (IsProcSelectable(proc))
                    {
                        appData    = CreateOrGetAppData(proc);
                        isChanged |= AddOrUpdateAppWinData(appData, hwndObj);
                    }
                }
            }
            procCache.ClearUnUsed();
            HwndObject.CacheClearUnUsed();
            return(isChanged);
        }