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

[Automation] TreeItems Cannot be Captured Properly

$
0
0

[Automation] TreeItems of WindowsApplication with target framework .Net 4.5.2 running on WinServer2012 R2 cannot be captured

I've created a sample windows application project containing a TreeView with two nodes. Each of the two nodes has child nodes.
Something like
-Node0

...Node2

...Node3

-Node1

...Node4

...Node5

...Node6

using the following code, it seems the tree items cannot be captured properly resulting to nodes.Count == 1. I'm expecting Count == 2 (Node0 and Node1)

using System.Windows.Automation;

namespace Tester
{
   public class Class1
   {
      public void Test()
      {
         var desktop = AutomationElement.RootElement;

         var forms = desktop.FindAll(TreeScope.Children, new PropertyCondition(AutomationElement.AutomationIdProperty, "MyForm"));

         var trees = forms[0].FindAll(TreeScope.Descendants, new PropertyCondition(AutomationElement.AutomationIdProperty, "treeView1"));

         var nodes = trees[0].FindAll(TreeScope.Descendants, new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.TreeItem));

      }
   }
}

Note:

I'v been using FindAll to recheck if only 1 instance is being captured.

Add Reference to:

  • UIAutomationClient (File Version: 4.0.30319.34211 built by: FX452RTMGDR)
  • UIAutomationTypes (File Version: 4.0.30319.34211 built by: FX452RTMGDR)

Some deductions.

  • Server OS: Win2008ServerR2
  • WinApp Target Framework: .Net 4.0
  • Result: OK

  • Server OS: Win2008ServerR2
  • WinApp Target Framework: .Net 4.5.2
  • Result: OK

  • Server OS: Win2012ServerR2
  • WinApp Target Framework: .Net 4.0
  • Result: OK

  • Server OS: Win2012ServerR2
  • WinApp Target Framework: .Net 4.5.2
  • Result: Not OK

Thanks


picture it in windows 10

$
0
0
will Microsoft picture it work in windows 10. I have windows 7 pro and use the XP emulator to run picture it

HOWTO Find AutomationElement (C#/.NET) from screen coordinates to an app under another app.

$
0
0

Please help,

I have a situation, where I have a transparent app over a target app, and I want to use System.Windows.Automation.AutomationElement.FromPoint(point) to find the target app, the FromPoint, always returns the AutomationElement from the transparent app.

How can I find the AutomationElement for the target app in this situation, keeping in mind, that I have to have the transparent app always active, and over the target app.

HOWTO Make a C#/Form based app, not be found System.Windows.Automation.AutomationElement.FromPoint.

$
0
0

Please help,

How can one, make their C#/Forms based application, NOT show up to System.Windows.Automation.AutomationElement.FromPoint?
That is, if another app, including the [C#/Forms-Base-App] itself, were to try and use System.Windows.Automation.AutomationElement.FromPoint where the screen coordinates passed into FromPoint were over the [C#/Forms-Base-App], would instead, return any AutomationElement object at the same screen coordinates, but behind the [C#/Forms-Base-App]?

Note, this question, is NOT the same as this one:  https://social.msdn.microsoft.com/Forums/en-US/855f4062-19f0-4d87-9601-243a1c45aa2a/howto-find-automationelement-cnet-from-screen-coordinates-to-an-app-under-another-app?forum=windowsaccessibilityandautomation

The difference in this question, is dealing with changing one's [C#/Forms-Base-App] to NOT show up on the FromPoint call.

IUIAutomationStylesPattern implementing issue

$
0
0

I am trying to use uiautomation to get a color of an element of paint application.I am using c++ on windows 10

I can easily access their size and state etc but i cant seem to find a way to get their background color? lets say i want to retrieve the color of the "new" button how do i do that?

https://msdn.microsoft.com/en-us/library/windows/desktop/hh437282%28v=vs.85%29.aspx

Here they did provide a property to retrieve the currentfillcolor property but it says that client application do not implement IUIAutomationStylesPattern interface. But then why did they provide it in the "UI Automation Client Programmers" section?

I have tried it but there is no IUIAutomationStylesPattern type available for me.

Can anyone help me in finding a way to make it work or if there's another way of approaching it?

Help me with my code

$
0
0

hiii

iam doing my mini project.. but iam stuck with my code..

Iam doing it in c++ and my project is to develop a simulator to compare different routing strategies in network on chip (NOC).

Hope you can help me with ma work.

UIAccess and Elevation without using the secure desktop

$
0
0

I am writing a remote desktop software similar to VNC and wanted to capture UAC prompts by leveraging functionalities given by UIAccess permission and Security policies.

Theory:

As per below given MSDN blogs, you need to set "Security Settings\Local Policies\Security Options\Allow UIAccess applications to prompt for elevation without using the secure desktop" property to "Enabled" in order to allow applications with 'UIAccess' permission to make the 'UAC prompt' to be displayed on user interactive desktop instead of secure desktop.

https://blogs.msdn.microsoft.com/cjacks/2009/01/08/helpdesk-elevation-on-windows-vista-and-windows-7/

https://blogs.msdn.microsoft.com/cjacks/2009/10/15/using-the-uiaccess-attribute-of-requestedexecutionlevel-to-improve-applications-providing-remote-control-of-the-desktop/

https://blogs.msdn.microsoft.com/asklar/2012/03/14/remote-assistance-and-uac-prompts/

Observation: I wrote a program with the below given code.

staticvoidMain(){System.Diagnostics.Process p =newSystem.Diagnostics.Process();
    p.StartInfo.UseShellExecute=true;
    p.StartInfo.FileName="cmd.exe";
    p.StartInfo.Verb="runas";
    p.Start();}

Then I added the following to app.manifest

<requestedExecutionLevellevel="asInvoker"uiAccess="true"/>

Then I self signed the application as per the MSDN forum instructions.

Then I manually copied the program to a subfolder in Program Files (x86) folder.

Then I enabled "Allow UIAccess applications to prompt for elevation without using the secure desktop" security policty.

When I run the program (in the same system where i generated certificate), I expected the UAC prompt to be shown in user's interactive desktop. But it is still running in 'secure desktop' even though the application invoked it has UIAccess permission.

What might have went wrong?

error: [Errno 10013] An attempt was made to access a socket in a way forbidden by its access permissions

$
0
0
I am doing a socket programming using python. when I have upgrade the windows from windows 7 pro to windows 10 pro,the program will not run and show the aforesaid error. I have tried to run the program by disabling both windows firewall and windows defender.But still program is not running.

TransformPattern.Resize is closing window upon resize

$
0
0

I am using the UIA TransformPattern.Resize pattern to resize a window. It works, but closes the window as soon as the resize shows. Is this intentional?

Here's the code that does the resize:

        internal static int Resize(AutomationElement control, double width, double height)
        {
            TransformPattern pat =
                (TransformPattern) CommonUIAPatternHelpers.CheckPatternSupport(TransformPattern.Pattern, control);
            if (pat.Current.CanResize)
            {
                pat.Resize(width, height);
                return 0;
            }
            return -1;
        }
As I said, the resize works, but it then closes the window (on both a WinForm and a WPF Form).

BUG C# - AutomationElement.FromPoint

$
0
0

I am convinced that AutomationElement.FromPoint in C# has a BUG. When using AutomationElement.FromPoint, it does not return the correct automation object. To reproduce this, run IE11, run the google.com page. Then run inspoect.exe from the Windows SDK. Inspect.exe will see the seach prompt, and will denote its BoundingRectangle. Then write a simple C# app that call AutomationElement.FromPoint on a screen point in the google's search prompt. Be sure to put the call into a separate thread, as per UI-automation Thread Issues (see https://msdn.microsoft.com/en-us/library/ms788709(v=vs.110).aspx ).

The object returned will not be the search prompt, but rather it will find an element, that is about 3 parents above the search prompt that is of ClassName "Internet Explorer_Server".

In inspect.exe, use the "Cursor" event handler, and click on the google's search prompt, and it will show that the "Internet Explorer_Server" element is 3 parents above the search prompt.

To ge the correct element, one will have to traverse up the UIA's tree, and then down, to get the lowest element that contains the point, and is visible.

This BUG has been logged by another here: http://stackoverflow.com/questions/34986741/automationelement-frompoint-gets-the-wrong-element

HOWTO Use UI-Automation with AutomationElement.FromPoint in C# like Inspect.exe in Windows SDK

$
0
0

Please help,

I'm trying to use UI-Automation's AutomationElement.FromPoint in C#, similar to the Inspect.exe tool from the Windows SDK.
The problem is that "AutomationElement.FromPoint" is evidently returning the wrong object.
At the minimum, it is not finding the correct object, with a bounding rect (AutomationElement.Current.BoundingRectangle).

But inspect.exe is.

As an example, run inspect.exe against IE11, when on the google.com website.
If you run AutomationElement.FromPoint from the screen position of the google.com's "search" prompt, the object returned will not have a bounding-rect (Rect.Empty). Also, the object returned from AutomationElement.FromPoint for the search prompt will not have a text value.

But in inspect.exe, which granted, uses the cursor, it will find the search prompt, and see its proper bounding-rect, and the text in the search prompt you type there.

Someone else has discovered this as well here:  http://stackoverflow.com/questions/34986741/automationelement-frompoint-gets-the-wrong-element
But, no solution has come forth.

How can I get past this issue with AutomationElement.FromPoint, and get the correct object, with its text and especially its AutomationElement.Current.BoundingRectangle, actually continaing the screen cooredinates passed to AutomationElement.FromPoint.

Window application textpattern problem

$
0
0
I am trying to get the text of windows and their elements using uia.

When i use inspect on the calculator in windows 10, i see that it doesn't support text pattern (its false). My question is how else can i access the button's text if text pattern is false? using windows 10 c++ (native UIA).

Access to Application Forms using String Names

$
0
0

Hi Guys,

Need a little help here. I have 5 forms in my project such as Form1, Form2, Form3, Form4 and Form5.

Can someone help me how can I call a certain form using its name? Is it possible? Or is there a way of getting my projects form collection? What I knew is the "OpenForm" property but what I need is to get/access all the forms whether its open or not.

Thanks in advance!

HOWTO Use UI-Auotmation with VS2015 and Debug.

$
0
0

Please help,

I need to use UI-Automation, and I have started the process of following the UIA requirements, to sign my app, and set the uiAccess=true in my app's manifest file see https://msdn.microsoft.com/en-us/library/ms742884(v=vs.110).aspx  ). But when I go to debug, I get this error:

The application manifest has the uiAccess attribute set to 'true'.
Running an Accessibility application requires following the steps described in Help

The help button goes here:
https://msdn.microsoft.com/en-us/library/dd831853(v=vs.140).aspx?appId=Dev14IDEF1&l=EN-US&k=k(vs.debug.error.launch_elevation_requirements)%3bk(TargetFrameworkMoniker-.NETFramework,Version%3dv4.5.1)&rd=true

That link does not denote any "steps" for this issue on how to proceed.

Also, for reference, my app is C#.

BUG uiAccess=true breaks WebBrowser control

$
0
0

BUG uiAccess=true breaks WebBrowser control

https://social.msdn.microsoft.com/Forums/en-US/bf7bf00c-a7be-40bb-b7cd-239bd5a80aa2/bug-uiaccesstrue-breaks-webbrowser-control?forum=windowsaccessibilityandautomation

Please help,

I have an application that uses a WebBrowser control in the main form. When I set uiAccess="true" in my manifest file, the WebBrowser control does not show, but does navigate. Interestingly, if I launch a modal dialog on the same form, the WebBrowser control shows.

No exceptions are thrown, or any output indicates any failure. Also, a tool like Fiddler, even show the HTTP traffic to the site there WebBrowser control navigates to, gets there with success.

I'm dead in the water without a solution to this.

To reproduce, to my knowledge.

1) Create a simple C#/WinForm app with the WebBrowser control, with the "this.TopMost = true" in the constructor.
2) Have the control navigate to something like www.microsoft.com.
3) Add a manifest to the app, but keep uiAccess = false.
4) Build your app, and install to Program Files (required for uiAccess = true in later steps).
5) Observe you app gets to www.microsoft.com and show the page in the WebBrowser control, and that a tool like Fiddler sees the http traffic to the site succeeds.
6) Open you manifest file, and set uiAccess = "true".
7) Rebuild, redploy to Program Files.
8) Observer, the WebBrowser control does not show.
9) Run something like Fiddler, and re-run the app, and observe that the site is successfully naviagted to, but the WebBrowser control is bnot shown.

EDIT, also, note while debugging your app, one will notice that the WebBroswer's "ReadyState" will be set to "Complete", in both steps (5) and (9), if you debug (via attach to process to the app in Program Files).

EDIT-2. I have missed a step, and added it to Step (1). The BUG only manifests itself when the form uses "TopMost = true" in the constructor along with uiAccess = "true".
And I confirmed, that any further reference to TopMost = true" with "uiAccess = "true" will likewise cause the WebBrowser control to NOT show, but it will still navigate.

EDIT-3 The "TopMost = true" can be set from the designer, and the BUG still manifests itself.

EDIT-4 - Work-Around. I have found that setting TopMost = true in the form's "_Load" handler after the WebBrowsewr control's first call to "Navigate", works. Anything from the desginer setting TopMost = true, to the constructor, or anything before the _Load" handler and first Novigate, BUG's out, and does not show the WebBrowser control if uiAccess = "true" in the manifest file.

This is a BUG, as setting TopMost = true in the designer, is a long standing standard practice.


Does Windows UI Automation support Toggle Button for WPF application?

$
0
0

Does Windows UI Automation support Toggle Button for WPF application?

The Toggle Button does not appear in the list of controls here:

https://msdn.microsoft.com/en-us/library/windows/desktop/ee671193(v=vs.85).aspx

Does it mean that Toggle Button is not supported?

Thank you!

HOWTO Get C# App to see all UI-Automation details like Inspect.exe

$
0
0

Please help,

I am trying to use UI-Automation, to see text and "Automation" information in other apps like the Windows SDK app called Inspect.exe. So far, I've gone down the path to ensure my C# app has a manifest file with uiAccess = "true", and digitally signed my app, and have it installed in "Program Files", as per UIA's requirements. But still, not all UIA information is revealed, like the AutomationElement's AutomationId.

The coding involved is so large, that there is simply not going to be a way to paste a code snippet, or even a whole project, to detail the issue, so rather than present a problem, is there a something well documented, to explain how to get a C# app to see all UI-Automation details like the Inspect.exe application.

The explanation should include the following:

1) The app must have a manifest with uiAccess = "true".
2) The app must be signed, and with a test certificate, with steps on how to create that certificate and get it trusted on a machine.
3) Explaantion of installing to Program Files so the uiAcess=true will work.
4) Code to read in all UI-Automation information like Inspect.exe does, with say IE11 browsing towww.google.com, to see all UI-Automation details on the google search prompt.
4.1) This should include getting:
4.1.1) The text in the search prompt.
4.1.2) The bounding rectangle coordinates/size of the search prompt.
4.1.3) The "UIA" AutomatioId and other key significant UI-Automation information that can be used to search UIA with to find the prompt (UIA's FindFirst).
4.1.4) The ability to see all parents of the search prompt likewise.

I have gotten down to 4.1.2, but the AutomationId (4.1.3) is not coming, which implies to me, either a BUG with UIA, and/or I've not down something like Inspect.exe, which can see the AutomationId.

UIAutomation - InvokePattern only works while Debugging - Button is not Recognized as a Button

$
0
0

I am manipulating an old program using UIAutomation. The issue I have involves pressing a button usingInvokePattern.

After pressing a button that opens up an explorer window and getting the AutomationElement for the window, I get the AutomationELement for an "Open" button, actually a SplitButton. I can find the element easily, but it comes up as a Pane control rather than a SplitButton Control. However, if I insert a breakpoint before looking for the Button element and manually step through the code in Debug mode, the "Open" button is recognized as a Button.

If I insert a breakpoint after finding the Button Element, the element Name and AutomationID are correct, but ControlType is a Pane instead of a Button. It's bizarre.

The offending code is below: (Net 3.5, VS2010, Win7 x64)

            InvokePattern bPattern = (InvokePattern)button.GetCurrentPattern(InvokePattern.Pattern);
            bPattern.Invoke();

            for (int wait = 0; wait < 50; wait++)
            {
                if (explorerWindow != null)
                    break;

                explorerWindow = reportWindow.FindFirst(TreeScope.Children,
                                                new PropertyCondition(AutomationElement.NameProperty, "Select Report"));

                Thread.Sleep(200);
            }

            explorerOpenButton = explorerWindow.FindFirst(TreeScope.Children,
                                    new PropertyCondition(AutomationElement.NameProperty, "Open"));

HOWTO get IHTMLElement (and/or IServiceProvider) from an IUIAutomationElement object in IE11

$
0
0

Please help,

I trying to get IHTMLElement objects from a C# client that uses the UIA api to a web page in IE11. To be specific, I am not the .NET wrapper class, as it is BUGGED, but rather, the COM based API. (Add reference to COM base UIAutomationClient, UIAutomationBlokcingCoreLig, UIA, and UIAutomationTypes).

With MSAA, this was possible by using MSAA's "AccessibleObjectFromPoint" for say a point on IE11 browsing google.com's serach prompt, and then use the IServiceProvide (COM base one Guid("6d5140c1-7436-11ce-8034-00aa006009fa")), and then call QueryService, to ultimately get the underlying IHTMLElement.

I do not know how to do this with UIA, if it is even possible. Some thoughts I have, is to maybe get the HTMLDocument of the page through UIA (somehow), and then use its getElementById, off the UIA's "AutomationId", which does match, as can be seen by using IE11's debugger (F12 and use the DOM-Point tool), and the Windows SDK's "Inspect.exe" tool, which will show that the UIA's "AutomationId" does match the HTML's id.

For reference, and clarifiction, here is the C# interface description for the IServicePRovider I was mentioning above:

    [ComImport]
    [Guid("6d5140c1-7436-11ce-8034-00aa006009fa")]
    [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface IServiceProvider
    {
      void QueryService(ref Guid guidService, ref Guid riid, [MarshalAs(UnmanagedType.Interface)] out object ppvObject);
    }

Also for clarification, the IHTMLElement, comes from "MSHTML" (Add reference "Microsoft HTML Object Library" in the COM area, which once added appears as MSHTML in the references).

Can't able to deduct the control when IsEnabled as False using CodedUI

$
0
0

I have a lots of custom controls in my WPF application and i have set IsEnabled as false for one custom control. And i try to deduct all the controls using hand code but the control if i set IsEnabled as false is not deduct, instead of this the previous control is deducted twice, could you please any one suggest how can i deduct the that control.

Regards,

Farjana Parveen Ayubb

Viewing all 585 articles
Browse latest View live


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