/////////////////////////////////////////////////////////////////////////////////////////////////
        //
        // RegisterFocusChangedListener()
        //
        // Add a UIA event handler to react to focus change events sent from UIA.
        //
        // Runs on the background thread.
        //
        /////////////////////////////////////////////////////////////////////////////////////////////////
        void RegisterFocusChangedListener()
        {
            // Create a cache request for the properties we know we'll need when a focus change occurs.
            // By setting up this cache request, we won't incur a cross-proc call later to get the
            // properties when we receive the event.
            IUIAutomationCacheRequest cacheRequest = _automation.CreateCacheRequest();

            cacheRequest.AddProperty(_propertyIdName);
            cacheRequest.AddProperty(_propertyIdBoundingRectangle);

            // The above properties are all we'll need, so we have have no need for a reference
            // to the source element when we receive the event.
            cacheRequest.AutomationElementMode = AutomationElementMode.AutomationElementMode_None;

            // Now set up the event handler.
            _automation.AddFocusChangedEventHandler(cacheRequest, this);

            _fAddedEventHandler = true;
        }