Sign in to follow this  
Followers 0
TomH

How to access controls embedded within .NET containers?

5 posts in this topic

Hi all,

I'm running XP Pro SP 2 and am automating the control of a DVD-Video warehouse and playback application designed for law enforcement patrol video. I'm trying to access embedded controls within .NET containers such as menuStrips and toolstripContainers but the AutoIT Window Info utility is unable to see inside the containers. Examples of what Window Info returns for some of these .NET containers are:

CLASS:WindowsForms10.window.8.app.0.202c666; INSTANCE:17 (Menu Bar)

CLASS:WindowsForms10.window.8.app.0.202c666; INSTANCE:14 (Tool Bar)

CLASS:WindowsForms10.SysListView32.app.0.202c666; INSTANCE:2 (List Box)

The problem is that each of the containers above has normal-looking Windows controls within it. I have only been able to manipulate the controls embedded within menuStrip(INSTANCE:17) and toolStripContainer(INSTANCE:14) by issuing ControlClick() against the container object and specifying the x,y coordinates that correspond to the menu item's location within the container, then using Send() to tab through the drop-down and <Return>. For example, to select the 2nd item in the "File" drop-down box in the menuStrip:

ControlClick("MyApplication","","[CLASS:WindowsForms10.window.8.app.0.202c666; INSTANCE:17]","left",1,20,10)

Send("{TAB 2} {ENTER}")

I'd like a better way to do this by directly accessing the embedded controls, but I can live with the above if need be.

My show-stopper problem is reading records from [CLASS:WindowsForms10.SysListView32.app.0.202c666; INSTANCE:2]. I need to be able to read all record entries within the SysListView32 container, find a DVD title match, then select the matched record for playback. The SysListView32 Window Info control descriptors are:

Class: WindowsForms10.SysListView32.app.0.202c666

Instance: 2

ClassnameNN: WindowsForms10.SysListView32.app.0.202c6662

Advanced(Class): [CLASS:WindowsForms10.SysListView32.app.0.202c666; INSTANCE:2]

ID: 3277324

Handle: 0x0032020C

How do I solve my show-stopper problem? Thank you for your response, and please let me know if I can provide you with more information.

Regards,

Tom

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

WindowsForms10.SysListView32.app.0.202c6662 ...

... should react finely to ControlListView() ...

The other controls I have had 'some' success with ControlSend and the keystrokes represented by the 'underlined' letters.

File/Exit

ControlSend("Title","","WindowsForms10.window.8.app.0.202c66617","fx")

Lar.

or...

ControlSend("Title","","WindowsForms10.window.8.app.0.202c66617","!fx")

Edited by LarryDalooza

f_mrcleansmalm_77ce002.jpgAutoIt has helped make me wealthy

Share this post


Link to post
Share on other sites

WindowsForms10.SysListView32.app.0.202c6662 ...

... should react finely to ControlListView() ...

The other controls I have had 'some' success with ControlSend and the keystrokes represented by the 'underlined' letters.

File/Exit

ControlSend("Title","","WindowsForms10.window.8.app.0.202c66617","fx")

Lar.

or...

ControlSend("Title","","WindowsForms10.window.8.app.0.202c66617","!fx")

I wonder if the success rate would go up if strictly handles were used... Unfortunately the Control* commands don't have an overload feature allowing different methods of passing the control identifier.

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

WindowsForms10.SysListView32.app.0.202c6662 ...

... should react finely to ControlListView() ...

The other controls I have had 'some' success with ControlSend and the keystrokes represented by the 'underlined' letters.

File/Exit

ControlSend("Title","","WindowsForms10.window.8.app.0.202c66617","fx")

Lar.

or...

ControlSend("Title","","WindowsForms10.window.8.app.0.202c66617","!fx")

Thanks, Larry - ControlListView() works great! I appreciate your quick response.

I'd like to incorporate your ControlSend() suggestion, but our application doesn't have shortcut keys for the menus(yet). Maybe I can talk the developer into putting those in there... :P

Have a good one.

Tom

Share this post


Link to post
Share on other sites

I'm trying to read values from .net controls by

$value = ControlGetText ( "window title", "", "[CLASS:WindowsForms10.window.8.app.0.11c7a8c; INSTANCE:11]" )

msgbox (0, "", $value)

the message box shows nothing.

I wonder if it is possible at all to get the current value of an edit control inside a .net container...

even less chances to read the contents of a grid inside a .net container, the AU3Info window just gives the ID, like "CLASS:WindowsForms10.window.8.app.0.11c7a8c; INSTANCE:11" of the whole container, but sees nothing inside of it, and there is no possibility to access individual cells in the grid...

does somebody know a way to solve this?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0