MenuStrip is still missing from UISpy

Hi!

My problem is that MenuStrip does not appear in UISpy. I generated a

simple WinForms application (not using WinFx), then put a menu strip at

the bottom of the Form. The menu lookes like this: | File | Help | .

Clicking on the File, a drop-down menu appears with Exit1 and

Exit2 items in it. There is nothing else on the Form.

Running this sample application, in UISpy the menu does net appear,

just this AutomationElement: "pane" "menuStrip1", but no control

pattern is allowed on this pane. If I click on the item File (with the

CTRL key), a new element appears in the UISpy treeview: "window"

"FileDropDown". Since it is window, only the window control pattern is

allowed. There are no menu items in FileDropDown, Exit1, Exit2 does not

appear in UISpy.

The other problem is that, when I release the CRTL and the drop down

list disappers, the AutomationElement ("window" "DropDownList") from

UISpy also disappears, and I cannot invoke the event from UISpy

that drops it down again.

It is interesting that if I run a Calculator on the system. Its menus

appears in the UISpy correctly, but these are "menu bar"-s, not

"pane"-s.

Can you help me, what's the problem? Is this problem with WinForms, or with the UIAutomation framework?

Thanks in advance, Mark

[1385 byte] By [MarkAsztalos] at [2008-2-2]
# 1
MenuStrips and standard Menus are 2 different things. You will see this same problem in certain MS applications such as (msn money, msn messenger, wmp). It will probably be alot more common until microsoft catches up, assuming UISpy is a MS application. I don't recall the name ever coming up as I'm really only familiar with Spy++.
MarcD at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Microsoft UI Automation...
# 2

Hi Mark - I'm the Accessibility and User Experience Program Manager for Visual Studio(1). I'm not familiar with UISpy, so perhaps you can tell us more about it, but part of the problem it appears you're running into is that the MenuStrip control (and all of our WinStrip controls, including ToolStrip) do not natively implement UI Automation. Instead, they have support for MS Active Accessibility, and rely on Windows-provided proxies to communicate with UIA.

Calc uses a system-standard menu control, for which (I believe) native UIA support exists, hence the difference in the behavior you see.

Thanks,
Aaron

(1) - well, really, for the Developer Division, which encompasses the .NET FX and the Windows Forms libraries, among other things

AaronBrethorstMSFT at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Microsoft UI Automation...
# 3
Thanks for the answers. I recognised the problem, and that's clear that

menuStrip does not connect natively to the UI Atuomation framework.

But, as far as I know, one aim of this framework is to reach all UI

elements through it, without specific information about its

implementation. I think that's why proxies are implemented for legacy

systems.

So my question is this: is it possible to reach the WinForms' menuStip

through UI Automation framework, or we have to do it as we did without

this framework? So my question is focused on the implemented proxies.

UISpy is a tool in Windows SDK, that searches all ui elements on the

screen, and displays them in a treeView. It can also be used to display

the UI Automation events.

Thanks, Mark

MarkAsztalos at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Microsoft UI Automation...
# 4

Hello,

I am currently sitting over the same problem. If the Strip does not support native UI Automation, why does the tool "AccExplorer" fully detect it. While the top level menu elements are detected as controls, the sub elements are detected as objects.

Thanks, Fritz

Witzbold at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Microsoft UI Automation...
# 5
Hey Mark,

I had the same problem and was able to implement a client side menu strip provider. The instructions can be found at:
http://nextgenerationaccessibility.blogspot.com/2006/07/creating-ui-automation-provider-for.html

Although the provider is not completely finished, I could give you the source code if you want. Just send me an email from the blog

Coder4Christ at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Microsoft UI Automation...
# 6
Hi there,

I tried providing a client-side implementation like described in the link provided above but as my provider resides in an external process, there is no way I can retrieve the MenuStrip instance given its hWnd in the external process. How do you get past this?

Dear Microsoftians, can you please please please shed some light on this out-of-process-Client-Side-Provider-access-problem? There doesn't seem to be a single article or example that handles this topic from scratch to gloss (pardon my ineptness at running searches if I'm wrong here, and please do provide a link where its been unraveled :)

Thanks is advance!

Chai
Chai.B at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Microsoft UI Automation...
# 7
Hey Chai,
I'm not sure what problem you are having.

When I did this, I was creating a prototype screen reader. I was able to read any menus from any .Net application without any problems.

Now, I have very limited Win32 experience, but it seemed like the following code worked to obtain a reference to any .Net control regardless of what AppDomain it belonged to:
Control controlFromHwnd = Control.FromHandle( hwnd );
From this reference, I was able to cast the control to a Menu and then read data from it and expose that for UIAutomation.

As far as finding a good article - at the time I wrote the blog entry, there was very little besides the MSDN documentation (which was very sketchy concerning ClientSideProviders). I really could not find anybody trying to do what I was trying.

In fact, I intended to create a community driven site for UIAutomation:
Creating Providers
Creating a Provider Framework to support scripting, OCR, etc.
Developing an Open Source Screen Reader

But although I believe such things should be done, I do not have the time to do them.

Coder4Christ at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Microsoft UI Automation...
# 8
Hey C4C,

Thank you for your reply, really appreciate it.

Are you referring to "MenuStrip" when you say "Menu"? Because Menu's have default UIA support whereas MenuStrips don't, right?

Can you please share your sources with me? I've left a note on your website where you shared your approach...

Cheers,

Chai.B at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Microsoft UI Automation...
# 9

Hi christ,

Can you send the sample source code? please? I'm new to this automation. N i'm dead tired of how wxactly menustrip can be accessed..
Awaiting your response.

Kavs_as@hotmail.com

Coder4Christ wrote:

Hey Mark,

I had the same problem and was able to implement a client side menu strip provider. The instructions can be found at:
http://nextgenerationaccessibility.blogspot.com/2006/07/creating-ui-automation-provider-for.html

Although the provider is not completely finished, I could give you the source code if you want. Just send me an email from the blog

ASKavya at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Microsoft UI Automation...
# 10

Hi All,

I encountered the same problem. After having a look at the link, I was able to get the menuStrip for my automation testing application.

However, I want to get access to the menuStrip items which are toolStripMenuItem, toolStripDropDownItem....but I cannot find any way.

Can anyone help me please?

KSLCam at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Microsoft UI Automation...
# 11
Hi,

afaik you cannot access the menu strip with UIAutomation. I obtain the elements with ActiveAccessibility.

MarcoAchtziger at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Microsoft UI Automation...
# 12
Hi Marco,

Sorry to continue this thread with some other topic. Not sure if u saw the other one posted.
had to catch hold of u Smile

There's this datagrid in one of our application. it is derived from 3rd party control called .netbar.

it is recognized as button in accexplorer32. I have no idea y is it so.

Can I have your suggestions on this please

Kavya

ASKavya at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Microsoft UI Automation...

Software Development for Windows Vista

Site Classified