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

How many characters can a Value property contain?

$
0
0

Hi to all!

How many characters can a ValuePattern.ValuePatternInformation.Value Property contain?

Thank you in advance!


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

XLS to VCF Converter

sticky keys and the shift key

$
0
0

I use sticky keys. Since the last windows update, after hitting the enter or tab key, I need to hit the shift key twice for it to work. What's going on?

Unable to launch browser from application

$
0
0

Server: Windows server 2012 R2

Hello, I am currently running an application which is attempting to open a browser but I am receiving a Win32Exception:

System.ComponentModel.Win32Exception (0x80004005): Access is denied

I was initially using selenium and the chromedriver to achieve this. When the browser is launched as a headless browser we have no problems, but when we remove the headless tag we get this error. I switched from the chromedriver to a firefoxdriver but still saw the same error. I switched from using selenium to just using a diagnostics.process.start (with the correct username, password, and domain) type of browser launching but still have the same issue. 

Within the server security policies I have given the necessary users access into the "Allow log on locally" "Allow log on through Remote Desktop Services" 

Are there other necessary policy changes that need to be made to allow an application to launch a browser?

Thank you.

UI Automation -- is unmanaged API still recommended for Windows 10?

$
0
0

Back in 2011, Guy Barker answered a question starting with this recommendation:

To give you some background, UI Automation (UIA) was introduced around the time of Windows Vista as part of the .NET Framework. That version of UIA was a managed API, and continues to be available with the .NET Framework. In Windows 7, an unmanaged version of the UIA API was introduced as part of Windows, separate from the managed .NET version. That Windows API had some enhancements which were not available in the .NET version, and that means that in general, if the results between the two APIs are not the same, the unmanaged API provides more useful information.

See https://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/c3f142e1-0624-4ec5-a313-482e72d5454d/problem-with-listitem-checkbox-using-automation-ui?referrer=https://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/c3f142e1-0624-4ec5-a313-482e72d5454d/problem-with-listitem-checkbox-using-automation-ui?referrer=https://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/c3f142e1-0624-4ec5-a313-482e72d5454d/problem-with-listitem-checkbox-using-automation-ui?referrer=https://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/c3f142e1-0624-4ec5-a313-482e72d5454d/problem-with-listitem-checkbox-using-automation-ui?forum=windowsaccessibilityandautomation

Is this still the recomemndation for Windows 10 in 2019 or has the Managed API caught up?


Fingerprint scanning application

$
0
0

Hello, I'm fairly new to hardware<->software development and I'm not exactly sure if this question is in the right place, but I'm pretty much sure that it has to do with Accessibility. 

Well, my problem is that I'm trying to interface a fingerprint scanner with a Windows Forms Application (C#), the fingerprint scanner being a Chinese made hardware namedSyno Finger Module USB Device (and its listed on the DVD/CD-ROM when looking it up on the Device Manager), with no proper documentation (I've managed to secure a "working" documentation, but it doesn't explain the body of the iceberg), a not accessible .lib and .dll file (when adding it as a reference on VS 2019 Enterprise) - pretty much Dependecy Walker is my friend at this point. When I tried accessing the fingerprint scanner using a kernel32.dll CreateFile, it returns a handle - but it returns an System.AccessViolationException at some point of the code during debugging execution. 

The scanner .dll file is written in C++ as stated on the documentation, so I know that datatypes are needed to be an exact match during calling. I'm in desperate need of enlightenment on what I'm doing wrong and what are my options at this point. 

The CreateFile function is using (SafeHandle hScanner = CreateFile(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, IntPtr.Zero, OPEN_EXISTING, 0, IntPtr.Zero))and it throws an exception at code line return PSGetImage(hHandle,nDevAddr). 

The exception thrown is:  

System.AccessViolationException: 'Attempted to read or write protected memory. This is often an indication that other memory is corrupt.'

Any input is welcome. Cheers!

Why multiline Textbox does have support of textpettern in COM API while it is there in Manage API?

$
0
0

I have created automation of window application using c# Manage code API. Everything was working fine but it was too slow. it was taking more that 10 second to find controll with manage code.

After learning about speed of COM API must fast than manage code , We shifted out project to COM API. We got the speed but we lost the search and cursor navigation functinality in multiline or single line textbox. While same thing is working fine with manage code api.

Please suggest any sollution, How can i get both textpattern in simple textbox and lighting speed of com API ?

As qiuck and simple sollution, I started using both COM and manage DLL, To get fast speed for search using COM API, And then convert to manage code "AutomationElement" using handler, after that perform text perttern using manage API. But don't why when i merge both mange code API and COM API in single project, COM api also start behaving slow ?


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

Magnification API - Setting up an include list for the Magnifier on Win7 is not working

$
0
0

 

Hi,

 

According to the Magnification API it is possible to get the Magnifier window to show only the selected windows in the magnified view. For that all you need to do is to call the MagSetWindowFilterList function with the MW_FILTERMODE_INCLUDE flag. But when I try to do so the function returns TRUE, but it has completely no effect on the filtering, the magnified view is just the same as it was before the call. On Vista this function works alright, I was able to successfully set an include list for the magnifier window, but not on Windows 7, however the usage of this function does not seem to be very complicated. And I also have to mention that the MagSetWindowFilterList function also works alright on Windows 7 with the MW_FILTERMODE_EXCLUDE flag, up to 12 windows (why 12?), and Vista does not have this limitation.

 

Is there any way to set a bunch of windows and show only them in the magnified view on Windows 7? And is really 12 the maximum number of windows that can be excluded from the magnified view on Windows 7? I tried this on both x86 and x64, and of course with Aero turned on, but the result was the same on both configurations (apart from the fact that sometimes the magnified view was a blank black view on x86 machines, but it is considered to be a Magnification bug according to these forums).

 

Any help would be  highly appreciated!

Best regards,

 

Peter

 

Inspect can find Button but UIAutomation in C++ cannot find it

$
0
0
This seems to be a common issue, but I have not uncovered the key to my issue.

This similar thread - (UI Automation cannot find an element. Inspect Object can )

 almost fits the description exactly.  And when the person in this thread said that they got theirs to work by using GetLastChild and GetPreviouSibling, I was hoping that it would do the trick for me.

I have a Windows 10 system with Visual Studio 2017 on it and it seems to find the Button that I am looking for very reliably.  When I deploy my executable and dll (C++ with /MTd Static Build) to another Windows 10 computer it will not find the button.



But if I run Inspect and just hover over the Button until the yellow square shows up, then my program finds the button and a whole lot more controls. 



(I first tried with C# and that didn't work, so was hoping that the C++ IUIAutomation would be the ticket.)


Automation Spy tool

$
0
0

Hi, here is a tool for searching and inspecting UI Automation elements on Windows desktop applications:

https://ddeltasolutions.000webhostapp.com/

Best regards.

UIAutomationClient vs Interop.UIAutomationClient

$
0
0

Hi,

Can you please explain what is the diff between UIAutomationClient and Interop.UIAutomationClient.

Also where i can get latest Interop.UIAutomationClient dll.

UI support by UIAutomationClient

$
0
0

Hi,

I am looking for some details about UIAutomationClient.

I want to know which type of element\application it supports like WPF, Win 32, JAVA, Sliverlight.

If anyone has link where all the supported application complete list i can find then it will be helpful.


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;
}


How to avoid automation freezing when application is hanging?

$
0
0

Situation:

If WPF or WinForms application hangs then UI Automation also hangs. Application can be freeze around 1 minute, but I need able to have access to UIAutomationClient for working with another application at this time.

So, I have Application A (WinForms) that can be freezed during 1 minute. I haveApplication B (WPF) that I need to use using automation tools whenApplication A is freezing. And I have Application C (Console Application) that keeps automation functionality for finding windows of other applications.

Parts of sample:

Application A freeze can be reproduced using an endless loop (infinite loop) during 1 minute. For example, I give the part of code below for the application button that should freeze for 1 minute:

private void button1_Click(object sender, EventArgs e)
{
     var counter = 0;
     while (true)
     {
          Thread.Sleep(100);

          counter++;
          if (counter > 600) // If counter == 600 then it means that 60 seconds has passed.
          {
               break;
          }
     }
}

Application B is simple WPF window without any controls.

Application C is using one main function that gives able to get windows:

var windows = AutomationElement.RootElement.FindAll(TreeScope.Children, Condition.TrueCondition);

---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ----------

Thanks in advance!

Whats the best tool to Automate Microsoft Dynamic AX

$
0
0

Hi All,

Currently we have a requirement to Automate Microsoft Dynamic AX windows application. As Coded UI is getting deprecated could any one suggest alternate UI Automation tool for Microsoft Dynamic AX

PowerShell "UpDate-Help" Problems

$
0
0

Help Needed

PowerShell Update-Help yields:

PS C:\WINDOWS\system32> update-help
update-help : Failed to update Help for the module(s) 'AppvClient, Defender, Microsoft.PowerShell.ODataUtils,
Microsoft.PowerShell.Operation.Validation, UEV, Whea, WindowsDeveloperLicense' with UI culture(s) {en-US} : Unable to connect to
Help content. The server on which Help content is stored might not be available. Verify that the server is available, or wait until
the server is back online, and then try the command again.
At line:1 char:1
+ update-help
+ ~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Update-Help], Exception
    + FullyQualifiedErrorId : UnableToConnect,Microsoft.PowerShell.Commands.UpdateHelpCommand
 
update-help : Failed to update Help for the module(s) 'WindowsUpdateProvider' with UI culture(s) {en-US} : Unable to retrieve the
HelpInfo XML file for UI culture en-US. Make sure the HelpInfoUri property in the module manifest is valid or check your network
connection and then try the command again.
At line:1 char:1
+ update-help
+ ~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (:) [Update-Help], Exception
    + FullyQualifiedErrorId : UnableToRetrieveHelpInfoXml,Microsoft.PowerShell.Commands.UpdateHelpCommand

I have tried en-US, en-UK & de-DE (German) Nothing worked

HelpInfoUri = "https://go.microsoft.com/fwlink/?linkid=390794" yields a time-out.

What do I do now ?





 

Can you add an IUIAutomation event handler from within the handler itself?

$
0
0

I'm implementing a COM shell extension handler. After the handler is loaded by File Explorer, I'd like to use IUAutomation to handle certain UI events (element selections). I was hoping to handle the events right within my class, so that the event handler would have access to member variables. So I added the IUIAutomationEventHandler interface and methods to my existing class. And in my class's setup methods (like FinalConstruct(), etc.), after obtaining the IUIAutomation object and performing other prep work, I did something like this:

pAutomation->AddAutomationEventHandler(   
     UIA_SelectionItem_ElementSelectedEventId,
     pRootElement,
     TreeScope_Subtree,
     NULL, 
     (IUIAutomationEventHandler*)this
);

This seems to work, EXCEPT in my testing, I've found that each element selection event gets fired twice. Now I'm not sure if that's because I added the event handler from within the handler itself. I also know that using IUIAutomation presents a number of threading issues, and maybe my setup violates those rules. So I was wondering if my approach is not permissible, and/or how to solve the issue of firing twice. Does the addition of the event handler have to take place on a different thread? And if so, how would one go about doing that within a COM class? Or is it important to place the entire IUIAutomation handler in a different class, and then just share data through global variables? Thank you very much for any insight.



why do managed uiautomation methods affects unmanaged uiautomation methods.

$
0
0

I'm using uiautomation to get controls of icons in "SVG ICON BUILDER"(available on ms store). for example, I move my cursor to the '$' icon.

The managed AutomationElement.FromPoint() method returns the background pane control.

But the unmanaged Uia returns a listitem control named dollar. (the unmanged uia tells that this listitem is a descendant of the background pane)

But if I change the sequence of the above two methods, they all get the background pane control.

Does anyone knows why this happens?

Thanks!!!

Viewing all 585 articles
Browse latest View live


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