0

WinAPI can get text from particular windows. However, VSFlexGrids are resistant to this since their grid data don't seem contained in easily-accessible child windows.

I've used Spy++ to analyze the VSFlexGrid in question, and it has no children. Yet, when I click a particular grid cell, a new child window seems to be dynamically created.

Question: Given this behavior, is there an easy way to get grid data from a VSFlexGrid using the Windows API, or some other "efficient" method? I'd like not to have to scrape screenshots or click each grid cell individually, as those methods would be slower than a WinAPI call (if a WinAPI method actually exists).

Asker
  • 1,299
  • 2
  • 14
  • 31
  • 1
    You can try UI Automation: https://learn.microsoft.com/en-us/windows/win32/winauto/entry-uiauto-win32 it's easy to test immediately, just use the "inspect" tool from Windows SDK and browse your Application. If the vendor is a serious one, it should add UI Automation support to its components. – Simon Mourier Dec 04 '20 at 08:46
  • Thanks, I've looked at the UIA docs and scanned my UI with "inspect." The element I want is an "Edit Control" that is created dynamically upon clicking, but does not seem to exist before clicking. Would you know of a way to access this control without clicking? – Asker Dec 07 '20 at 05:02
  • 2
    Yes, the UI tree changes with the user using the UI. You can't access it without clicking, there's no magic, the control doesn't exist before it's created. But with UIA you can also simulate clicks using "patterns", like the Invoke pattern: https://learn.microsoft.com/en-us/windows/win32/winauto/uiauto-implementinginvoke you can test that with Inspect too. there are some frameworks over UIA that simplify things like https://github.com/FlaUI/FlaUI (for .NET) – Simon Mourier Dec 07 '20 at 07:40

0 Answers0