Jump to content

How to access controls embedded within .NET containers?


TomH
 Share

Recommended Posts

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

Link to comment
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")

Edited by LarryDalooza

f_mrcleansmalm_77ce002.jpgAutoIt has helped make me wealthy

Link to comment
Share on other sites

  • Moderators

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.

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.

Link to comment
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

Link to comment
Share on other sites

  • 2 months later...

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?

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...