1

I'm trying to click a button in one application using C#, This is how it looks in the Spy++

Spy++

And I got the ToolBar handle and there are buttons under it that Spy++ can't see and they look like this:

Buttons

but Inspect sees them:

inspect

so my question is how can I handle those without position clicking?

Here are the first buttons properties from Inspect

Inspect Button Properties

Sinatr
  • 20,892
  • 15
  • 90
  • 319
  • Use https://devblogs.microsoft.com/oldnewthing/20141013-00/?p=43863 on that window? – GSerg Jun 30 '21 at 07:02
  • The toolbar buttons probably map to a WM_COMMAND wParam ID value. Is there a way to spy on the thread message queue and sniff the number? – Jeremy Lakeman Jun 30 '21 at 07:05
  • 1
    Get to the button element and then use the InvokePattern's Invoke method on it https://learn.microsoft.com/en-us/dotnet/api/system.windows.automation.invokepattern.invoke similar to this (in C++) https://stackoverflow.com/a/68060247/403671 – Simon Mourier Jun 30 '21 at 07:37
  • 2
    @JeremyLakeman Why? What's wrong with UI Automation? – David Heffernan Jun 30 '21 at 09:18

0 Answers0