Quantcast
Channel: Windows Desktop Development for Accessibility and Automation forum
Viewing all 585 articles
Browse latest View live

Modal Dialogs and UI automation

$
0
0

Hi,

I am playing around with WPF and Automation trying to do the following.

Application A:  Display a WPF window with a Button.  The button has a handler - when clicked you get a message box.

Application B: Automation Controller (unit test).  The code starts an in instance of A, and programatically (AutomationElement) pushes the button, which launches the message box.  So far all of this works.

When I use the UI Spy program, I notice that when I do things manually, the message box is a child of the main window in the visual tree.  When I run things through the automation controller, the message box seems to be a sibling of A in terms of Window hierarchy (and no longer modal!).  This sort of makes sense, but the documentation (Invoke) says that a modal dialog will stop everything.  Is the behaviour I am seeing correct?

I would like Application B not only to launch the 'modal' dialog, but also to test (get) that both Window title and message are correct; then I would like to programmatically push the OK button to make the message box disappear -- is this is possible?

Friedrich Brunzema


System.OverflowException: Arithmetic operation resulted in an overflow error while capturing the external window

$
0
0

Hello,

I am trying to capture an element from an external window and also highlight that element with red border. I do this on mouse down event. Here is my WndProc for the mouse down event:

protected override void WndProc(ref Message m)
{

    switch (m.Msg)
    {
                        case 0x0200: //MouseMove
                        AutomationElement element = AutomationElement.FromPoint(new System.Windows.Point(Cursor.Position.X, Cursor.Position.Y));
                        if (element != null && !element.Equals(capturedElement))
                        {
                            GDI32.RedrawWindow(capturedElement);
                            GDI32.HighlightWindow(element);
                            capturedElement = element;
                        }
                        break;
                    default:
                        break;
    }

base.WndProc(ref m);
}

RedrawWindow method definition:

        public static void RedrawWindow(AutomationElement element)
        {
            if (element != null)
            {
                try
                {
                    IntPtr handle = IntPtr.Zero;
                    if (element.Current.NativeWindowHandle == 0)
                    {
                        AutomationElement ancestor = TreeWalker.ControlViewWalker.GetParent(element);
                        while (ancestor != null && ancestor.Current.NativeWindowHandle == 0)
                            ancestor = TreeWalker.ControlViewWalker.GetParent(ancestor);
                        if (ancestor != null)
                            handle = new IntPtr(ancestor.Current.NativeWindowHandle);
                    }
                    else
                        handle = new IntPtr(element.Current.NativeWindowHandle);

                    User32.InvalidateRect(handle, IntPtr.Zero, true);
                    User32.UpdateWindow(handle);
                    User32.RedrawWindow(handle, IntPtr.Zero, IntPtr.Zero, (uint)(RedrawTypes.RDW_FRAME | RedrawTypes.RDW_INVALIDATE | RedrawTypes.RDW_UPDATENOW | RedrawTypes.RDW_ALLCHILDREN | RedrawTypes.RDW_ERASENOW | RedrawTypes.RDW_INTERNALPAINT));
                }
                catch
                {
                    //TODO: unhandled exception
                }
                
            }

        }

HighlightWindow method definition:

        public static void HighlightWindow(AutomationElement element)
        {
            try
            {

                System.Windows.Rect r = element.Current.BoundingRectangle;
                int startX = 2;
                int startY = 2;
                IntPtr dc = IntPtr.Zero;
                if (element.Current.NativeWindowHandle != 0)
                    dc = new IntPtr(User32.GetWindowDC(element.Current.NativeWindowHandle));
                else
                {
                    dc = GDI32.CreateDC("DISPLAY", null, null, IntPtr.Zero);
                    startX += (int)r.Left;
                    startY += (int)r.Top;
                }

                using (Graphics g = Graphics.FromHdc(dc))
                {
                    using (Pen red = new Pen(Color.Red, 4))
                    {
                        g.DrawRectangle(red, new Rectangle(startX, startY, (int)r.Width - 4, (int)r.Height - 4));
                    }
                }
            }
            catch 
            {

            }
        }

When I try to capture and highlight the element from an external window, I get following error:

System.OverflowException: Arithmetic operation resulted in an overflow.
   at MS.Internal.AutomationProxies.XSendMessage.HitTestTreeView(IntPtr hwnd, Int32 x, Int32 y)
   at MS.Internal.AutomationProxies.WindowsTreeView.ElementProviderFromPoint(Int32 x, Int32 y)
   at MS.Internal.AutomationProxies.ProxyFragment.System.Windows.Automation.Provider.IRawElementProviderFragmentRoot.ElementProviderFromPoint(Double x, Double y)
   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
   at MS.Internal.Automation.UiaCoreApi.CheckError(Int32 hr)
   at MS.Internal.Automation.UiaCoreApi.UiaNodeFromPoint(Double x, Double y, UiaCacheRequest request)
   at System.Windows.Automation.AutomationElement.DrillForPointOrFocus(Boolean atPoint, Point pt, UiaCacheRequest cacheRequest)
   at System.Windows.Automation.AutomationElement.FromPoint(Point pt)
   at QAliber.Repository.CommonTestCases.UITypeEditors.UIControlLocatorForm.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

I do not understand what is the root cause of this error.

I am using Windows 10. The code is working fine for Windows 7. Could you please shed some light on this Windows specific error?

Thank you in advance!

UIAutomation can not read the component text

$
0
0
I have two machines with the same specifications and operating system (Windows 7), but only one can read the text of the components, the other only the name of the window.
I have examined the application using UIAccess, the difference that I notice is that the machine with the problem does not exist Microsoft: MSAA Proxy in the value of ProviderDescription.
I am new using UIAutomation, can someone tell me if there is a solution to this problem?

How to find hidden elements/invisible elements in grid in windows forms using UIA

$
0
0

Hi,

I want get all hidden elements/inivisble elements on the grid in windows forms.am getting all the hidden elements using UIpath.But i don't want use it instead using UIA how can i get those elements.

taskbar folder color

$
0
0
can you change the color of the text on a folder in your taskbar?

UI Automation performance

$
0
0

Hi,

I'm developing a program listening to the UI events from a desktop program. This would be based upon the MS UI Automation technology. Basically this is to callAddAutomationEventHandler/AddPropertyChangedEventHandlerso that to hook up with the UI Automation events. 

Initially, this UIA client program was developed with C#, and it worked, however, the performance was very bad - e.g. after I clicked a button in my application, the Invoke_Invoked event took more than 1 minute to get to the UIA event handler. Then I looked through the documents, and followed it to call the above methods in a separate thread, and the problem was still there.

Then I started a new UIA client program with C++/raw COM interface, and followed the UIA thread guidelines, and the performance became much better - almost same as AccEvent. 

So to me, it seems like:

- if the UIA client program is based off C# interface, then the performance is much bad.

- if the UIA client program is based off C++ interface, then the performance is much better.

So is this performance issue a known one to the C# interface? Or did I miss something in the C# implementation?

Here are some more details:

- The C# program, I started with a default WPF desktop program, and then started a new MTA thread which acted as the bridge to the UIA interface. In the MTA thread, I called AddAutomationEventHandler/AddPropertyChangedEventHandlerto add the handlers (the handlers do nothing but calling System.Diagnostics.Debug.WriteLine("Event"));

To make sure the thread doesn't quit, I added Dispatcher.Run() after I setup those event handlers.

- The C++ program, I started with a MFC dialog based program, and then started a thread which is initialized with COINIT_APARTMENTTHREADED. And then I also call the above two functions to add the handlers.

To make sure the thread is still alive, I added the message pump (GetMessage(), DispatchMessage()) after I setup those event handlers.

Here is the MSDN UIA guidelines that I follow:

https://docs.microsoft.com/en-us/dotnet/framework/ui-automation/ui-automation-threading-issues, https://docs.microsoft.com/en-us/windows/desktop/winauto/uiauto-threading

Any suggestions?

Thanks,

Yuming

Question regarding sync rule

$
0
0

Hello,

I have the following synchronization challenge:

Want to sync only user objects where upn ends with "int.kbcorp.de" AND where the admindescription is "SyncMe".

Unfortunately this will not work. Users are synchronized when the domain suffix is different.  I assume the problem is the AND operating process. When I setup a inbound rule with just the upn rule, this alone will work. A rule with just the admindescription alone will also work. But together, with the AND processing in the clause, it will not work. Are there any ideas where my misunderstanding and my fault is?

Thanks a lot for giving me an idea

Klaus

 

Chrome Slowness and CPU usage in Windows 10 (1903)

$
0
0

Hi ,

We have an accessibility based solution for capturing the Chrome URL's. Initially we were using IAccessible2 interface and couple of months back we had Chrome slowness and CPU usagae.

To counter this we moved to UI Automation for URL capturing and this was working without any issues till Windows 10 1803.

When we tried with Windows 10 1903, Chrome was having slowness and CPU usage with UI automation. According to the 1903 update on UIAutomation now it uses IAccessble2 for Chrome.

So is there way in which we can uses pure UI Automation without IAccessible2 for Chrome as used in 1803 Windows 10.

Thanks


set favorites keys

$
0
0
How do I set the favorites keys on my ms natural ergonomic keyboard 4000?

UIA Event Handlers leaking handles

$
0
0

I have been testing a Microsoft supplied sample of a C++ IUIAutomationEventHandler program.
The link to the source code is https://docs.microsoft.com/en-us/windows/desktop/winauto/uiauto-howto-implement-event-handlers#handling-general-ui-automation-events.
I used Visual Studio 2017 to build a standard console application using the sample code on Windows 10.

After starting the UIA application, I then repeatedly started and stopped the Calculator program. The Windows Task Manager revealed that the UIA application handle count kept
growing each time, the Calculator program was started and stopped.

I feel there is some resource is not being freed. Has anyone run across this issue as well, or knows how to prevent the handle leak from occurring?

Below is a copy of the source code from the link above:

// Defines an event handler for general UI Automation events. It listens for
// tooltip and window creation and destruction events. 
#include <windows.h>
#include <stdio.h>
#include <UIAutomation.h>

class EventHandler:
    public IUIAutomationEventHandler
{
private:
    LONG _refCount;

public:
    int _eventCount;

    // Constructor.
    EventHandler(): _refCount(1), _eventCount(0) 
    {
    }

    // IUnknown methods.
    ULONG STDMETHODCALLTYPE AddRef() 
    {
        ULONG ret = InterlockedIncrement(&_refCount);
        return ret;
    }

    ULONG STDMETHODCALLTYPE Release() 
    {
        ULONG ret = InterlockedDecrement(&_refCount);
        if (ret == 0) 
        {
            delete this;
            return 0;
        }
        return ret;
    }

    HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppInterface) 
    {
        if (riid == __uuidof(IUnknown)) 
            *ppInterface=static_cast<IUIAutomationEventHandler*>(this);
        else if (riid == __uuidof(IUIAutomationEventHandler)) 
            *ppInterface=static_cast<IUIAutomationEventHandler*>(this);
        else 
        {
            *ppInterface = NULL;
            return E_NOINTERFACE;
        }
        this->AddRef();
        return S_OK;
    }

    // IUIAutomationEventHandler methods
    HRESULT STDMETHODCALLTYPE HandleAutomationEvent(IUIAutomationElement * pSender, EVENTID eventID)
    {
        _eventCount++;
        switch (eventID) 
        {
            case UIA_ToolTipOpenedEventId:
                wprintf(L">> Event ToolTipOpened Received! (count: %d)\n", _eventCount);
                break;
            case UIA_ToolTipClosedEventId:
                wprintf(L">> Event ToolTipClosed Received! (count: %d)\n", _eventCount);
                break;
            case UIA_Window_WindowOpenedEventId:
                wprintf(L">> Event WindowOpened Received! (count: %d)\n", _eventCount);
                break;
            case UIA_Window_WindowClosedEventId:
                wprintf(L">> Event WindowClosed Received! (count: %d)\n", _eventCount);
                break;
            default:
                wprintf(L">> Event (%d) Received! (count: %d)\n", eventID, _eventCount);
                break;
        }
        return S_OK;
    }
};

int main(int argc, char* argv[])
{
    HRESULT hr;
    int ret = 0;
    IUIAutomationElement* pTargetElement = NULL;
    EventHandler* pEHTemp = NULL;

    CoInitializeEx(NULL,COINIT_MULTITHREADED);
    IUIAutomation* pAutomation = NULL;
    hr = CoCreateInstance(__uuidof(CUIAutomation), NULL,CLSCTX_INPROC_SERVER, __uuidof(IUIAutomation), (void**)&pAutomation);
    if(FAILED(hr) || pAutomation==NULL) 
    {
        ret = 1;
        goto cleanup;
    }
    // Use root element for listening to window and tooltip creation and destruction.
    hr = pAutomation->GetRootElement(&pTargetElement);
    if (FAILED(hr) || pTargetElement==NULL) 
    {
        ret = 1;
        goto cleanup;
    }

    pEHTemp = new EventHandler();
    if (pEHTemp == NULL) 
    {
        ret = 1;
        goto cleanup;
    }

    wprintf(L"-Adding Event Handlers.\n");
    hr = pAutomation->AddAutomationEventHandler(UIA_ToolTipOpenedEventId, pTargetElement, TreeScope_Subtree, NULL, (IUIAutomationEventHandler*) pEHTemp);
    if (FAILED(hr)) 
    {
        ret = 1;
        goto cleanup;
    }
    hr = pAutomation->AddAutomationEventHandler(UIA_ToolTipClosedEventId, pTargetElement, TreeScope_Subtree, NULL, (IUIAutomationEventHandler*) pEHTemp);
    if (FAILED(hr)) 
    {
        ret = 1;
        goto cleanup;
    }
    hr = pAutomation->AddAutomationEventHandler(UIA_Window_WindowOpenedEventId, pTargetElement, TreeScope_Subtree, NULL, (IUIAutomationEventHandler*) pEHTemp);
    if (FAILED(hr)) 
    {
        ret = 1;
        goto cleanup;
    }
    hr = pAutomation->AddAutomationEventHandler(UIA_Window_WindowClosedEventId, pTargetElement, TreeScope_Subtree, NULL, (IUIAutomationEventHandler*) pEHTemp);
    if (FAILED(hr)) 
    {
        ret = 1;
        goto cleanup;
    }

    wprintf(L"-Press any key to remove event handlers and exit\n");
    getchar();

    wprintf(L"-Removing Event Handlers.\n");

cleanup:
    // Remove event handlers, release resources, and terminate
    if (pAutomation != NULL) 
    {
        hr = pAutomation->RemoveAllEventHandlers();
        if (FAILED(hr))
            ret = 1;
        pAutomation->Release();
    }

    if (pEHTemp != NULL) 
        pEHTemp->Release();

    if (pTargetElement != NULL) 
        pTargetElement->Release();

    CoUninitialize();
    return ret;
}

Simulate drag and drop behavior using C#

$
0
0

Hello Sir,

I am working on a Automation desktop application.

I have source and destination coordinates.

Now, I want to simulate Windows drag and drop operation using those coordinations.

Could you please point me some suggestions on this topic?

Thank you in advance!

Link problems with #define INITGUID

$
0
0
I am using Visual Studio 2008 Professional and trying to add UIA to a custom control. This control is similar to the example program FragProviderUnmgd found in
c:\Program Files\Microsoft SDKs\Windows\v6.1\Samples\winui\UIAutomation\FragProviderUnmgd\

The files compile but fail to link with the following errors. I set uiautomationcore.lib in the input of the link.

1>ListProvider.obj : error LNK2001: unresolved external symbol _SelectionItem_ElementSelectedEvent_Event_GUID
1>ListProvider.obj : error LNK2001: unresolved external symbol _ListItem_Control_GUID
1>ListProvider.obj : error LNK2001: unresolved external symbol _List_Control_GUID
1>ListProvider.obj : error LNK2001: unresolved external symbol _SelectionItem_Pattern_GUID
1>ListProvider.obj : error LNK2001: unresolved external symbol _Selection_Pattern_GUID
1>ListProvider.obj : error LNK2001: unresolved external symbol _ControlType_Property_GUID
1>ListProvider.obj : error LNK2001: unresolved external symbol _ItemStatus_Property_GUID
1>ListProvider.obj : error LNK2001: unresolved external symbol _IsKeyboardFocusable_Property_GUID
1>ListProvider.obj : error LNK2001: unresolved external symbol _IsContentElement_Property_GUID
1>ListProvider.obj : error LNK2001: unresolved external symbol _IsControlElement_Property_GUID
1>ListProvider.obj : error LNK2001: unresolved external symbol _HasKeyboardFocus_Property_GUID
1>ListProvider.obj : error LNK2001: unresolved external symbol _Name_Property_GUID
1>ListProvider.obj : error LNK2001: unresolved external symbol _AutomationId_Property_GUID
1>ListProvider.obj : error LNK2001: unresolved external symbol _LocalizedControlType_Property_GUID
The compile command line is

/Od /I "../include" /I "../Provisioning/Common/inc" /I "../Common" /D "WIN32" /D "_DEBUG" /D "_WINDOWS"
/D "_VC80_UPGRADE=0x0600" /D "_MBCS" /Gm /EHsc /RTC1 /MTd /Yu"stdafx.h" /Fp".\Debug/WPST.pch" /Fo".\Debug/" /Fd".\Debug/" /FR".\Debug\\" /W4 /c /ZI /TP .\ListProvider.cpp


The link command line is

/OUT:".\Debug/XSample.exe" /INCREMENTAL /LIBPATH:"..\lib" /MANIFEST /MANIFESTFILE:".\Debug\XSample.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'"
/DELAYLOAD:"OleAcc.dll" /DEBUG /PDB:".\Debug/XSample.pdb" /SUBSYSTEM:WINDOWS /DYNAMICBASE:NO /MACHINE:X86 haspms32.lib haspms32 hasp32b Ws2_32.lib version.lib skey.obj uiautomationcore.lib DelayImp.lib

With some help from
http://lists.helixcommunity.org/pipermail/helix-client-dev/2006-April/004259.html

I figured out that when
#define INITGUID
is added to the beginning of the source files of a different project the GUIDs are resolved. But in this particular project I use the following includes for MFC :
#include <afxwin.h>         // MFC core and standard components
#include <afxext.h>         // MFC extensions

#include <afxdisp.h>        // MFC Automation classes

#ifndef _AFX_NO_OLE_SUPPORT
   #include <afxdtctl.h>           // MFC support for Internet Explorer 4 Common Controls
#endif
#ifndef _AFX_NO_AFXCMN_SUPPORT
   #include <afxcmn.h>                     // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
When I add "#define INITGUID", I get the following error message:
1>c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\atlcomcli.h(365) : error C2065: 'GUID_NULL' : undeclared identifier
1>c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\atlcomcli.h(371) : error C2065: 'GUID_NULL' : undeclared identifier
1>c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\atlcomcli.h(387) : error C2065: 'GUID_NULL' : undeclared identifier
1>c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\atlcomcli.h(415) : error C2065: 'GUID_NULL' : undeclared identifier
1>c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\atlcomcli.h(446) : error C2065: 'GUID_NULL' : undeclared identifier
1>c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\atlcomcli.h(452) : error C2065: 'GUID_NULL' : undeclared identifier
1>c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\atlcomcli.h(468) : error C2065: 'GUID_NULL' : undeclared identifier
1>c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\atlcomcli.h(2579) : error C2065: 'GUID_NULL' : undeclared identifier
1>c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\atlcomcli.h(2819) : error C2065: 'GUID_NULL' : undeclared identifier
What am I missing?

Need to set AutomationID for Controls or Elements that through INSPECT.EXE show the name but do not show ID

$
0
0

Hi to all!

Last tame I have a problem related with accessibility to AutomationID.

AutomationID not displayed for me through INSPECT.EXE. It shows the Name but don't shows AutomationID.

UISpy.EXE shows: AutomationID: "".

For example, items that are important to me first: TreeNode and TabItem.

Which ways exist for set AutomationID for WinForms Elements?


Thank you in advance!

Fast UIA TreeWalk

$
0
0

I am trying to resolve the following problem using the Windows UI Automation API:

Given a point on the desktop (x, y) I want to determine VERY FAST (less than 100msec) the following:

  1. The AutomationElement under the (x, y)
  2. The set of AutomationElements representing the path from the pointed element all the way to the root (or to the top level window).

Issue 1 seems simple: call ElementFromPoint(x, y). Simple testing on random points yields a result in around 20msec on average, depending on how complex and how deep the clicked element was in the visual tree.

Issue 2 is more complicated: I don't seem to find a way to use caching to speed up the walk up the visual tree:

  • caching the whole visual tree is too slow and might never finish according to the doc; even if I manage to cache everything, it is invalidated after a few user actions and needs refresh
  • scoping caching to Ancestors is not allowed (the idea being that as you go deeper in the UI the upper levels of the visual tree are cached already and need no refreshing)
  • Find all clickable elements along with their ancestry seems slow as well 

The idea behind this is to calculate the XPath for each clicked element on the GUI during execution of a global mouse hookbefore calling the next hook handler (synchronously rather than  async). If the handler is slow the user experience is impacted and eventually the handler is unsubscribed by Windows. Based on some reading if handler takes more than 100msec the GUI starts to feel sluggish.

I know Windows is not a real-time OS and using absolute times is not really applicable so take the 100 msec as "fast enough so user does not notice".

I am hoping someone out there resolved this problem already and can give some guidance. Better yet, I am hoping someone that has internal knowledge of this API can give some indication of the feasibility of plan or an alternative to it.

Thank you very much!!!

John C

Bluetooth "Join a Network Area Network"

$
0
0

I need to make a c++ program to connect to a bluetooth device with NAP (Network Access Point) protocol.

In details I need to do this operations programmatically from c++ code:

  1. Search for the bluetooth device
  2. Pairing the selected device
    (At this point I see that a new network connection is available)
  3. Do the “Join to Personal Area Network”
  4. Connect to the device using an access point
  5. Receive the “connection successful” notification

  6. Disconnect from the device network
  7. Remove the device


GetFocusedElement returns root element insted of focused element

$
0
0

I'm trying to use GetFocusedElement and then getting properties UIA_IsValuePatternAvailablePropertyId to see if I can modify the text of the control.

When I make the call I'm getting the root element, when in fact a child element has the focus.

If I run Inspect, it manages to report the correct control that has the focus.

So what do I additionally need to do to find the real or actual control that has the focus?

Thanks.


Michael Tissington

WPF: desktop application support Narrator

$
0
0

Hi,

I create a desktop application base on WPF.

But, when I action Narrator and focus my application, that can't read information for some elements such as Label and Textblock.

I set AutomationProperties.Name for Button and it is work fine, but Label and Textblock can not.

Am I misunderstanding or lack of something?

UIAutomation not finding elements on some machines

$
0
0

Hi,

I'm using the UIAutomation framework in my application to read the url from Chrome browser. the principal is to find the URL search bar and read the text from it.

I'm using the following condition:

 Condition nameCond = new AndCondition( new PropertyCondition( AutomationElement.NameProperty, "Address and search bar"),
                                          new OrCondition( new PropertyCondition( AutomationElement.ControlTypeProperty, ControlType.Edit ),
                                                           new PropertyCondition( AutomationElement.ControlTypeProperty, ControlType.Text ) ) );

it was working fine for long time now, and still is, but suddenly on some machine the element is not found. I looked both in UISpy and Inspect on such machine and it seems like part of the elements tree is missing or not recognized.

I tried to compare chrome versions, win os, .NET, but couldnt find any reason why it fails on some machines...

any idea??

Default Onscreen Keyboard z-ordder

$
0
0

Hello,

I noticed the default Windows 10 Onscreen Keyboard is able to display itself on top of any other window. It is able to stay on top of the Z-orderr over any windows withWS_EX_TOPMOST flag. How can I make my custom onscreen keyboard exhibit the same behavior? I know it's possible, because I have seen a third-party onscreen keyboard with the same feature (Touch-It Onscreen Keyboard from Chessware).

UI Automation Framework AddAutomationFocusChangedEventHandler Memory Leak in Internet Explorer 11 on Server 2019

$
0
0

I've noticed that any time the UI Automation Focus Change event is hooked, Internet Explorer will leak memory with every page load.  This only happens on Server 2019, which is an issue when running thin clients.  Is there any solution to this issue?

Environment:

Windows Server 2019 Standard V 10.0.17763 Build 17763

Internet Explorer 11 Version 11.678.17763.0 Update Version 11.0.140 (KB4511872)

Sample console application to trigger the memory leak:

Program.cs:

using System;

namespace UIAWorkBench
{
    class Program
    {

        static void Main(string[] args)
        {
            UIAutomationWorker worker;

            Console.WriteLine("Starting Watcher ...");
            worker = new UIAutomationWorker();

            Console.WriteLine("Subscribe Focus Change Event");
            worker.SubscribeFocusChange();

            Console.WriteLine("Watching ...");
            Console.ReadLine();
        }

    }
}

UIAutomationWorker.cs:

using System;
using System.Windows.Automation;

namespace UIAWorkBench
{
    class UIAutomationWorker
    {

        public UIAutomationWorker()
        {
        }
        public void SubscribeFocusChange()
        {
            try
            {
                // Hook Focus Change Event
                Automation.AddAutomationFocusChangedEventHandler(UIAFocusChange);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        private void UIAFocusChange(Object sender, AutomationFocusChangedEventArgs e)
        {
            // Do Nothing
        }

    }
}

Viewing all 585 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>