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

Wake on Lan c#

$
0
0

I have developed a  c#  wake on lan application to turn on the computers in network and it work fine in same subnet.

BUT I am not able to turn on the pcs connected to a different subnet.

Can you suggest any better solutions for this.

Thanks in advance.


batch file for zip oldest folder

$
0
0

Hi team,

I need to zip the oldest directory from the source directory and after zipping process completes I have to paste the newly zip file to the new destination folder and then delete source directory.

Please find the image for reference.

Here we need to zip the oldest folder "201879" and then paste the zip folder "201879.zip" in the new destination and then delete the folder "201879" from source.

Please suggest a batch file for the whole process.


Unmanaged UIAutomation API: Accessing IUIAutomatonElement from another thread

$
0
0

I'm trying to develop library that allows testing application's user interface using microsoft unmanaged UIAutomation API. I'm having hard time with resolving an implementation problem regarding accessing elements from another threads such as event handlers. I'm using interop dll to access UIAutomation, so API initialization looks like this:

static public IUIAutomation automation = new CUIAutomation();

For example: I'm subscribing to window opened event :

automation.AddAutomationEventHandler(UIA_EventIds.UIA_Window_WindowOpenedEventId, automation.GetRootElement(),

TreeScope.TreeScope_Subtree, null, this);

then as I am invoking button in some random WinForms application that opens dialog window I get inside the 

HandleAutomationEvent(IUIAutomationElement sender, int eventId)


where I would like to access "YES" button in dialog from using   

sender.FindFirst(tree,MyClass.automation.CreatePropertyCondition(UIA_PropertyIds.UIA_NamePropertyId, "YES"));

The search takes ages since it can't access COM object from Single-Threaded Apartment. I cant get the approach from microsoft documentation to work: 

https://docs.microsoft.com/en-us/windows/desktop/winauto/uiauto-threading 

I've tried subscribing to events from another threads, as well as calling element access functions such as `FindAll` or `FindFirst` from another threads with `[MTAThread]` attribute but I can't get anything to work - the effect is still the same. I wonder if there an option where the elements would be contained in MTA, even when not thread-safe. I am a total begginer when it comes to C#,WinForms and COM Objects so I would appreciate every bit of information that could help.

UIAutomation for DevExpress controls issue

$
0
0

Hello,

Could you please help me to figure out the cause of problem related to UIAutomation.
The problem consists in impossibility to invoke (click) button in UI application (on some PC’s it works fine on some – not).
I was able to find that this problem is actual only for DevExpress-buttons.
When my utility is looking for a control (through Microsoft's UI Automation), in PC’s, where problem occurs, button is recognized as ControlType.Pane (instead of ControlType.Button) and when we are trying to invoke such control,InvalidOperationException-is thrown  (with Unsupported Pattern-message) asPane doesn’t support such kind of pattern.


In source code problem is in this part:

AutomationElement rootElement = AutomationElement.RootElement;
if (rootElement != null)
{
    Condition condition = new PropertyCondition(AutomationElement.AutomationIdProperty, <main window name>);
    AutomationElement appElement = rootElement.FindFirst(TreeScope.Children, condition);

    if (appElement != null)
    {   

      AutomationElement uiAutoElement = appElement.FindFirst(TreeScope.Children, new PropertyCondition(AutomationElement.AutomationIdProperty, <button name to invoke>)); // in some PC's, control type is as expected - button, in some PC's - pane.

If I use Inspect.exe, to check control type, there is shown 'button' and it could be invoked from Inspect.

 

All the controls suddenly turned to ControlType.Pane

$
0
0
My application is using Microsoft UI Automation to build a tree that shows the different controls, their name and values. This works fine. However every so often something happens, not able to pinpoint why, but all the controls are of type ControlType.Pane. When I use Inspect they show their real types (e.g. ControlType.Button or ControlType.Edit), but through my app all the controls return type as ControlType.Pane. Even the localize control type name is Pane. 

Why is this happening? Not sure if this is an MS UIA bug or something that I am doing? Please help.

UIAutomation. "RemoveStructureChangedEventHandler" takes much time.

$
0
0

Hello,

Calling "RemoveStructureChangedEventHandler" leads to a long period of waiting for it to be finished.

The interesting moment is that that I do not have any problems with either "RemoveFocusChangedEventHandler" or "RemovePropertyChangedEventHandler".

But I still face with that by calling "RemoveAllEventHandlers" :( (it is quite reasonable though).

Sometimes it's even about not finishing at all (it resembles a deadlock).

In my considered opinion, the more the handler is being used (the more events are processed i.e.) the more time the "RemoveStructureChangedEventHandler" method is being executed. Could this be so?

In addition to:

1) There are no any other threads which could add or remove event handlers as well;

2) If we have a look at the handler signature:

HRESULT HandleStructureChangedEvent(
  IUIAutomationElement *sender,
  StructureChangeType  changeType,
  SAFEARRAY            *runtimeId
);

we will see that there are two parameters (sender and runtime) which we have to deallocate by ourselves (UIAutomation isn't in charge of doing that), won't we?

I understand that not every detail of the program is covered. But I tried to do my best speaking of the most important once. So please, let me know if you need any other details.
Thanks in advance!

UIAutomation. "RemoveStructureChangedEventHandler" takes much time

Sign into Microsoft account using powershell

$
0
0

Hello All,

The below are the problems we have

  1. Script needed for silently sign into Microsoft account in Windows 10 RS-3+
  2. Enabling One drive with script.
  3. Uploading files into One drive using power-shell / python (any scripting)

Is it possible to Sign in into Microsoft account using script? (We have test account for signing in).

Could you please let me know if we can achieve the same using windows automation?

Thanks, Ajay

wake on commands to turn on PC using AMT in c#

$
0
0

I am developing an windows application in c# to turn on the PC in my LAN using AMT commands. Can any one suggest me a proper way to do it or provide any code for it.

Thanks in advance.



Failure to call IAccessible in Windows 10

$
0
0
Hello everybody,

We have an issue on Microsoft Active Accessibility interacting with our UI elements. It could be related to the SDK upgrading from version 6.0 to version 7.0.  In Windows 10, the AccessibleObjectFromWindow function sends WM_GETOBJECT to UI elements with a 10-digit wParam identifier, but in Windows 7, the wParam identifier in the same case only has 4 digits.  Such a difference would cause failure to call IAccessible in Windows 10.

Here are the steps for the comparison between Windows 10 and Windows 7 for the client:
1.The client calls Windows API: AccessibleObjectFromWindow
2.AccessibleObjectFromWindow send WM_GETOBJECT request message to the UI element
3.The UI element return IAccessible interface back to the client
4.Debug the client UI element with the received IAccessible interface and found that the wParam identifier has value 4294967295 in Windows 10
5.Use the same client and did the same test in Windows 7, the wParam identifier is a 4-digit value

May I know if the SDK upgrade from version 6.0 to version 7.0 impact on the Accessibility function? Any more information about the wParam code reference, or information about how it is generated?

Convert Unmanaged IUIAutomationElement to Managed AutomationElement

$
0
0

For some performance reason, I am doing searches in the accessibility tree using C++ unmanaged UIA API. However most of our other functions take Managed AutomationElement in .NET for other processing. I do not want to re-write all of them due to various reasons including time. 

Is there a way to convert unmanaged IUIAutomationElement* to managed AutomationElement in .NET?

get_accChild: What is a child ID?

$
0
0

Hi all,

the IAccessible::get_accChild function is essentially declared like this in the C++ interface:

HRESULT get_accChild(VARIANT varChild, IDispatch **ppdispChild)

The parameter varChild describes the child whose interface the client wants, and I have read many times that it can be CHILDID_SELF, or something else. But what is the "something"? Is it the tab index, based at 1 (because CHILDID_SELF is 0)? Is it a child window's control ID? Can it be negative? (Is it always a LONG value, or can it be some other type?)

The inspect.exe tool reveals the "AutomationId" and the "LegacyIAccessible.ChildId" properties which sometimes (but not always) have the same value. How is this value defined? IAccessible does not have a method like get_ChildId.

How is the order defined in which an automation client like inspect.exe retrieves children of an accessible object? I am asking because inspect.exe displays children in different order than what I would like to see.

All these question refer to a native C++/MFC test project which I created to explore MSAA, which is a simplification of a real situation which should become automation-enabled. (I have several more questions but not before these simple ones are answered.) The code is available on OneDrive.

Thanks for your help...

Hans

RDP - Server 2016 - Disconnect actaully Logoff - Close running applications

$
0
0

Hello, I'm trying to resolve an RDP quirkiness or misunderstanding

  • RDP (mstsc) to Server 2016 | Access to Desktop (Admin)
  • Raise VS2015
  • Disconnect RDP (Disconnect Prompt Dialog - Programs will continue to run)
  • Wait 1 minute | Reconnect (mstsc) | VS2015 still raised
  • Disconnect RDP (Dialog presented)
  • Wait 2 mins | Reconnect (mstsc)

It appears that Disconnect is 'Logging OFF'

Settings applied

Local GP | Comp Config | Admin Template | Win Component | Remote Desktop Sess | Sess Time Limits

  • 'Set Time Limit for Disconnect Sessions' -> Enabled | Value 'Never

Any direction is appreciated :)

Thank You - Covi


Mark Covian

UIAutomation beginner's questions

$
0
0

Now that I have explored MSAA for a while, I am trying to dive into UIAutomation. Unfortunately there is not so much information around, and native C++ examples are rare. I am working on the server (provider) side only because the client will be a 3rd party automatic test tool.

I have come to the following assumptions and questions and I would appreciate any comment on these.

  • To support UIA, a window responds to a WM_GETOBJECT message with lParam==UiaRootObjectId by returning, through the UiaReturnRawElementProvider function, a pointer to an object that implements IRawElementProviderSimple.
  • IRawElementProviderFragment represents the root of a hierarchy, and is in a sense equivalent to the MSAA concept of a "complex control". Since I couldn't find a way to return a IRawElementProviderFragment, should I implement IRawElementProviderFragment and IRawElementProviderSimple in the same class, and use QueryInterface to return the fragment provider?
  • Some docs mention IUIAutomationElement. Is it correct to return this interface in QueryInterface of the IRawElementProviderSimple (like in my previous question for the fragment)?
  • There are no equivalents to the get_accChildCount and get_accChild functions of IAccessible. Children can only be obtained through the Navigate function of the fragment provider.
  • The Navigate function retrieves a fragment provider, but when you navigate to a child, it need not be the root of a hierarchy. So why a fragment and not a simple provider, which is the more general concept? Or, if I am wrong about this idea, what is the use of a simple provider that is not a fragment provider?
  • Should a IRawElementProviderFragment also implement IRawElementProviderFragmentRoot? To me, the fragment root provider looks like methods that were forgotten to include in the fragment provider.
  • Any other interfaces I should implement, apart from those that are returned as pattern providers, to establish basic UIA functionality?

Please keep in mind that I am working with native (unmanaged) C++, with MFC and STL support. My mission is to understand UIA, not to find the best-of-all implementation. My scenario is a control in a dialog (implemented as a CWnd-derived class) that has in internal structure which I want to make UIA accessible.

Thanks a lot

Hans

API for Scaling and Layout for Display settings in the Windows 10 settings console?

$
0
0
What is the API to use to set the global value applications will use to scale appropriately? Is there a registry setting for this? I am not asking about DPI, I am talking about the variable that all applications use to rescale text, items, and the window independent of DPI.

Automation: Selecting menu item and/or sub-menu items from another application

$
0
0

I am working on a automation testing project. I want to create a command which will simulate a "select menu item" behavior. This should select a menu item from another application's window.

List of such commands is like a automation script to me [when replayed, all the commands execute in sequence]

For example, list of commands will be like:

1. Run a program [Start Process command]

2. Select a file menu [Click Mouse command]

3. Select File->menu item [Command yet to be written]

4. Select File->menu item->sub menu item [Command yet to be written]

I already have "Click Mouse" command. In this command configuration, I have a control locator by which I can locate the menu from another application. After locating that menu, it saves control information of that menu which will be helpful when script is replayed. [Which will automatically select menu]

However, I can not select menu items and/or sub menu items using control locator of "Click Mouse" command. 

So, is there a way [maybe using windows API, I am not sure], to save the information of submenu items, and select that menu item while replaying the script.

Thank you in advance!


Click/Select contextual menu by name

$
0
0

Hello,

Here is my requirement:

1. Simulate right click on specific screen coordinates. It will open a contextual menu like below.

2. Click/Select contextual menu item [For example, item "Evaluate" in above image] by its name automatically.

I have fulfilled 1st requirement. Now, I want finish second one.

Could you please tell me how can I achieve this?

Thank you in advance! 


Windows 10 - Set tablet buttons to perform certain tasks.

$
0
0

Hi Sir,

In Control Panel > Hardware and Sound > Tablet PC Settings > Set tablet buttons to perform certain tasks.

There is error popup message but we really install button drivers on the system. There are 3 buttons on the tablet. (Power button, volume up and volume down). "Set tablet buttons to perform certain tasks" looks to launch Apps by buttons but how to do that? Is there any documents or reference link describes how to do that?

Thanks.


Terence Liu

AutomationFocusChangedEventHandler method is calling only once

$
0
0

Hello 

I am working on a Automation Project. I have a requirement to trace the elements on which I focused the mouse.

Here is a Start() method to start listening the AutomationFocusChangedEvent:

        public void Start()
        {
            //check if we are tracing
            if (_isFocusTracing == true)
                throw new InvalidOperationException("cannot call StartFocusTracing mutliple times");

            using (new WaitCursor())
            {
                try
                {
                    //set the event handler
                    Automation.AddAutomationFocusChangedEventHandler(new AutomationFocusChangedEventHandler(OnAutomationFocusChanged));
                    _isFocusTracing = true;
                    OnStartFocusTracing();
                }
                catch (Exception ex)
                {
                     ApplicationLogger.LogException(ex);
                    _isFocusTracing = false;
                }
            }
        }

And here is a handler method for AutomationFocusChangedEvent:

        private void OnAutomationFocusChanged(object src, AutomationFocusChangedEventArgs e)
        {
            Debug.WriteLine("OnAutomationFocusChanged ...");

            OnAutomationFocusChanged((AutomationElement)src);
        }

The problem with the above code is that, the handler method OnAutomationFocusChangedis only called for the first element that I focused. For further focused elements, handler method is not called. That means, this method is calling only once. [Here, I am focusing the elements from external Windows application]

Could you please tell me where I am going wrong in this case?

Thank you in advance!

Debugging with uiAccess=true

$
0
0

My application requires uiAccess=true in manifest file and becomes digitally signed during post build event.

 

<requestedPrivilegesxmlns="urn:schemas-microsoft-com:asm.v3"><requestedExecutionLevellevel="asInvoker"uiAccess="true"/></requestedPrivileges>


When I try to run my application from the debugger with VS2008 or VS2010 I get the following error:


Error while trying to run project: Unable to start program [Application].

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


[OK] [Help]


But the help button is redirecting me to a "Page not found"-Website.


Is it even possible to debug an application with uiAccess=true ?



Martin

Deploying RDS Remote Desktop Service on Windows 2012 R2 in a WorkGroup Enviroment

$
0
0

Hi,

I installed and configured RDS licensing server on Windows 2012 R2, however no license has been issued despite that the grace period notification is not appearing.

I have got open RDS license - per Device.

Could you please help resolve this problem.

Regards,

TF

Viewing all 585 articles
Browse latest View live


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