Sign in to follow this  
Followers 0
SSMark

How to get data and control a Datagridview?

2 posts in this topic

#1 ·  Posted (edited)

Good morning, i'm trying to automate an external c# .net 4 windows form app, the problem is that it uses few DataGridView and i must get the inside data, to double click on a exact row etc... 

but seems not possible using autoit and maybe isn't possible also in other ways....

 

From autoit v3 window info:
 

>>>> Control <<<<
Class: WindowsForms10.Window.8.app.0.2bf8098_r40_ad1
Instance: 3
ClassnameNN: WindowsForms10.Window.8.app.0.2bf8098_r40_ad13
Name: 
Advanced (Class): [CLASS:WindowsForms10.Window.8.app.0.2bf8098_r40_ad1; INSTANCE:3]
ID: 7801540
Text: 
Position: 12, 93
Size: 530, 296
ControlClick Coords: 415, 84
Style: 0x56010000
ExStyle: 0x00000000
Handle: 0x00770AC4

From Microsoft Inspect:
How found: Selected from tree...
Name: "DataGridView"
ControlType: UIA_TableControlTypeId (0xC374)
LocalizedControlType: "tabella"
BoundingRectangle: {l:35 t:159 r:565 b:455}
IsEnabled: true
IsOffscreen: false
IsKeyboardFocusable: true
HasKeyboardFocus: false
AccessKey: ""
ProcessId: 15488
RuntimeId: [2A.770AC4]
AutomationId: "dataGridView1"
FrameworkId: "WinForm"
ClassName: "WindowsForms10.Window.8.app.0.2bf8098_r40_ad1"
NativeWindowHandle: 0x770AC4
ProviderDescription: "[pid:7412,hwnd:0x770AC4 Main:Nested [pid:15488,hwnd:0x770AC4 Main(parent link):Microsoft: MSAA Proxy (unmanaged:uiautomationcore.dll)]; Hwnd(parent link):Microsoft: HWND Proxy (unmanaged:uiautomationcore.dll)]"
IsPassword: false
HelpText: ""
LegacyIAccessible.ChildId: 0
LegacyIAccessible.DefaultAction: ""
LegacyIAccessible.Description: ""
LegacyIAccessible.Help: ""
LegacyIAccessible.KeyboardShortcut: ""
LegacyIAccessible.Name: "DataGridView"
LegacyIAccessible.Role: tabella (0x18)
LegacyIAccessible.State: può essere attivato (0x100000)
LegacyIAccessible.Value: ""
IsAnnotationPatternAvailable: false
IsDragPatternAvailable: false
IsDockPatternAvailable: false
IsDropTargetPatternAvailable: false
IsExpandCollapsePatternAvailable: false
IsGridItemPatternAvailable: false
IsGridPatternAvailable: false
IsInvokePatternAvailable: false
IsItemContainerPatternAvailable: false
IsLegacyIAccessiblePatternAvailable: true
IsMultipleViewPatternAvailable: false
IsObjectModelPatternAvailable: false
IsRangeValuePatternAvailable: false
IsScrollItemPatternAvailable: false
IsScrollPatternAvailable: false
IsSelectionItemPatternAvailable: false
IsSelectionPatternAvailable: false
IsSpreadsheetItemPatternAvailable: false
IsSpreadsheetPatternAvailable: false
IsStylesPatternAvailable: false
IsSynchronizedInputPatternAvailable: false
IsTableItemPatternAvailable: false
IsTablePatternAvailable: false
IsTextChildPatternAvailable: false
IsTextEditPatternAvailable: false
IsTextPatternAvailable: false
IsTextPattern2Available: false
IsTogglePatternAvailable: false
IsTransformPatternAvailable: false
IsTransform2PatternAvailable: false
IsValuePatternAvailable: false
IsVirtualizedItemPatternAvailable: false
IsWindowPatternAvailable: false
FirstChild: "Riga superiore" 
LastChild: "Riga superiore" 
Next: [null]
Previous: "DataGridView" tabella
Other Props: Object has no additional properties
Children: "Riga superiore" 

 

i was trying to control/get data from it using sendmessage but i don't find the constants available for example for the listviews,listboxes etc.. nothing for the DataGridView, i'm stuck

Thanks in advance

Edited by SSMark

Share this post


Link to post
Share on other sites



Windows Forms can be automated with the UI Automation framework.

Download the two UDFs in bottom of first post, and download and run the code in the "Simple spy demo" codebox in the middle of first post. The "Simple spy demo" will provide the same information as Inspect.exe, when Inspect.exe is running in UI Automation mode (and from the output in the text box, I can see, that it is).

To verify that a control can be identified place the mouse cursor over the control and press Ctrl+w. You can see an example here.

Note that the framework is based on COM interface objects (created with ObjCreateInterface), so it's not just as easy to use as most built-in commands.

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