public DesktopWindowCollection() : base(new ObservableCollection <DesktopWindow>()) { //Make sure that the collection is synchronized with ui thread. this.SynchronizeWithUIThread(); //Get existing windows AddRange(WindowUtility.Enumerate()); HookUtility.AddHook(HookUtility.Event.OBJECT_CREATE, Add); HookUtility.AddHook(HookUtility.Event.OBJECT_DESTROY, OnWindowDestroyed); Poller.Update += Update; Update(); }
public FormMain() { InitializeComponent(); HookUtility.HookByProcessName(textProcessNames.Text.Split('|')); }