private void InitPoller()
        {
            IntPtr handle = handleGetter();

            if (handle == IntPtr.Zero)
            {
                poller = null;
                return;
            }
            poller = new WindowPoller(handle);
        }
        /// <summary>
        /// Watches the window with the given handle, optionally keeping this
        /// process active until the remote process closes or this watcher is
        /// disposed.
        /// </summary>
        /// <param name="windowHandle">The window handle.</param>
        /// <param name="keepAlive">Whether to keep this process alive.</param>
        public BasicWatcher(IntPtr windowHandle, bool keepAlive)
        {
            this.poller = new WindowPoller(windowHandle);

            Update();

            new Thread(() =>
            {
                Thread.CurrentThread.IsBackground = !keepAlive;

                while (isRunning)
                {
                    Thread.Sleep(10);
                    Update();
                }
            }).Start();
        }
Beispiel #3
0
 /// <summary>
 /// Ctor. Only requires a pointer to a control.
 /// </summary>
 /// <param name="hWnd"></param>
 public WindowInfo(IntPtr hWnd)
 {
     Handle = hWnd;
     Poller = new WindowPoller(hWnd);
 }