How to access elements that Spy UI does not see to automate a win32 application using C #

I am making a C # Windows form application that automates another win32 application using the System.Windows.Automation classes.

There are some elements that I need to read or interact with, but UISpy does not find these fields, it only found the parent panel of the container.

For example, this code block below should return many toolbar buttons, but it doesn’t work:

var mainWindow = AutomationElement.RootElement.FindChildByNamePart("Back Office Control");
var mainWindowChildren = mainWindow.FindAll(TreeScope.Children, Condition.TrueCondition);
var toolBarPanel = mainWindowChildren[1];
var toolBarItens = toolBarPanel.FindAll(TreeScope.Children, Condition.TrueCondition);

Is there any other way to do this?

+4
source share
2 answers

, Windows. .

, Windows, WM , , TB_PRESSBUTTON (http://msdn.microsoft.com/en-us/library/windows/desktop/bb787389(v=vs.85).aspx).

SendMessage WinAPI, ( hWnd, ), TB_PRESSBUTTON , wParam 1 lParam.

+2

Win32. GetWindow

- http://msdn.microsoft.com/en-us/library/windows/desktop/ms633515%28v=vs.85%29.aspx

[DllImport("user32.dll")] public static extern int GetWindow(int hwnd,int wCmd); 
0

All Articles