Question

Is there out-of-the-box way to create UI Automation provider for third party controls that not support UI Automation?

My problem: I try to automate vb6 application with VsFlexGrid ActiveX control and fail to access its properties and methods.

Thank you

Was it helpful?

Solution

It's possible, but it's a lot of work, and not appropriate in all circumstances.

The key requirements are that the target control:

  • has a HWND of its own, preferably with a well-known and stable class name

  • has a well-defined way of communicating with that control from another process. Controls that use some set of windows messages (like the Win32 common controls) fall into this category, as do controls like the MS Internet Explorer control, which exposes an extensive interface (IHTMLDocument).

But if the control doesn't have some way of accessing its information externally, then UI Automation won't help much: all UIA is doing here is allowing you to slot an adapter class into its existing framework; but it's not giving you any new or extra tools to deal with getting at the underlying information in the first place.

Old VB-era ActiveX controls are something of a challenge: if you can get at one control on the form, you can use the various COM interfaces to navigate to the other controls on that form and access their properties. But the catch is that you can't easily do this from another process. And few, if any, of these ActiveX controls support any sort of windows messages, since they assume that the client code will be using the COM interfaces instead.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top